我從瀏覽器發(fā)起Get請(qǐng)求,參數(shù)如下:
let uid = parseInt(params.get("uid"));
let nickname = params.get("nickname");
let avatar = params.get("avatar");
let phone = params.get("phone");
//產(chǎn)品信息
let store_name = params.get("store_name");
let stock = params.get("stock");
let sales = params.get("sales");
let ficti = params.get("ficti");
let price = params.get("price");
let image = params.get("image");
然后服務(wù)器這邊也接收到了請(qǐng)求,在customerServer.js里面打了斷點(diǎn),在該文件第396行,代碼如下:
this.connentServerDom.style.display = 'none';
this.iframe_contanier.contentWindow.postMessage({
type: 'getImgOrText',
productInfo: this.settingObj.productInfo
}, "*"); // 傳送圖文數(shù)據(jù)
this.iframe_contanier.contentWindow.postMessage({type: 'openCustomeServer'}, "*"); //通知iframe 打開(kāi)了客服彈框
//打開(kāi)聊天窗事件
window.$chat.emit('openChatWin');
明明向子頁(yè)面發(fā)送了通知 getImgOrText,在子頁(yè)面的created()里也監(jiān)聽(tīng)了這個(gè)消息
window.addEventListener("message", e => {
console.log(e);
// 獲取圖文數(shù)據(jù)
switch (e.data.type) {
case 'getImgOrText':
this.userKey = e.data.key;
if(e.data.productInfo) {
this.productMessage = e.data.productInfo;
}
break;
子頁(yè)面對(duì) productMessage 進(jìn)行了watch
watch: {
productMessage: {
handler(val, oldVal) {
console.log(val == oldVal);
//沒(méi)有生效,是否是這里的原因
if(JSON.stringify(val) != JSON.stringify(oldVal)) {
this.isShowProductModel = true;
this.goPageBottom(); // 滑動(dòng)到頁(yè)面底部
}
},
deep: true
},
但不知道什么原因這里沒(méi)有生效,請(qǐng)問(wèn)可能是什么原因呢,也不報(bào)錯(cuò)
【產(chǎn)品名稱(chēng)】:CRMEBChat
【產(chǎn)品版本】:v1.2.0
【部署方式】:linux/寶塔面板
【部署環(huán)境】:虛擬機(jī)Centos7本地環(huán)境
【php版本】:7.4
【Mysql版本】:5.7
【使用終端】:客戶(hù)端Chrome瀏覽器,后臺(tái)Vue使用webstorm編譯運(yùn)行在本地8080端口