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