31a3c8f8 by joe

去掉语音转换时的reload,用事件取代

1 parent fc07e343
......@@ -98,7 +98,13 @@ export default {
mounted() {
this.initData();
},
created() { },
created() {
this.$root.eventBus.$on("langChange", () => {
try {
this.tips = this.i18n.customService.unauth[this.tipModel];
} catch (e) { }
});
},
watch: {
userInfo(val) {
if (val && val.name) {
......
......@@ -13,30 +13,31 @@ export default {
return {
activeIndex: 0,
sTitle: this.dataObj && this.dataObj.name || '',
reloadBlackList: []
};
},
props: {
type: {
type: String,
default () {
default() {
return "nav";
}
},
dataObj: {
type: Object,
default () {
default() {
return {};
}
},
dataList: {
type: Array,
default () {
default() {
return [];
}
},
labelProperty: {
type: String,
default () {
default() {
return "name";
}
}
......@@ -81,10 +82,15 @@ export default {
// 如果是语言设置,则设置语言
let lang = curData.value;
if (lang != localStorage.getItem('lang')) {
// this.$i18n.locale = lang;
// this.sTitle = curData.name;
localStorage.setItem("lang", lang);
if (this.reloadBlackList.indexOf(this.$route.path) >= 0) {
window.location.reload();
} else {
this.$i18n.locale = lang;
this.sTitle = curData.name;
this.$root.eventBus.$emit("langChange");
}
// console.log(this.$route);
}
} else {
// if (curData.value == "logout") {
......@@ -171,5 +177,5 @@ export default {
return this.dataList[this.activeIndex][this.labelProperty];
}
},
created() {},
created() { },
};
......
......@@ -67,7 +67,7 @@ export default {
this.dropdownMVisible = true;
} else if (evtStr == 'login') {
this.loginMVisible = true;
} else {}
} else { }
},
checkIsSmallScreen() {
const self = this;
......@@ -122,7 +122,9 @@ export default {
// self.checkIsSmallScreen();
// }
window.addEventListener('resize', () => this.checkIsSmallScreen(), false);
this.$root.eventBus.$on("langChange", () => {
this.initData();
});
},
watch: {
userInfo(val) {
......
......@@ -247,5 +247,11 @@ export default {
mounted() {
this.initData();
},
created() { }
created() {
this.$root.eventBus.$on("langChange", () => {
try {
this.initData();
} catch (e) { }
});
}
}
......
......@@ -79,5 +79,11 @@ export default {
created() {
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;
this.$root.eventBus.$on("langChange", () => {
try {
this.initData();
} catch (e) { }
});
}
}
......
......@@ -72,5 +72,10 @@ export default {
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;
this.initData();
this.$root.eventBus.$on("langChange", () => {
try {
this.initData();
} catch (e) { }
});
}
}
......
......@@ -26,5 +26,9 @@ export default {
mounted() {
this.initData();
},
created() { }
created() {
this.$root.eventBus.$on("langChange", () => {
this.initData();
});
}
}
......
......@@ -599,6 +599,8 @@ export default {
}
},
},
beforeDestroy() {
},
created() {
this.initData();
try {
......@@ -609,5 +611,10 @@ export default {
this.$root.eventBus.$on("/register", () => {
this.type = 1;
});
this.$root.eventBus.$on("langChange", () => {
try {
this.initData();
} catch (e) { }
});
}
}
......
......@@ -4,7 +4,7 @@
<auth @onLogout="userLogout" v-show="false"></auth>
<iframe sandbox="allow-top-navigation" v-if="outsideUrl" id="myiframe" width="100%" height="100%" scrolling="yes" frameborder="0" :src="outsideUrl"></iframe>
<iframe v-if="outsideUrl" id="myiframe" width="100%" height="100%" scrolling="yes" frameborder="0" :src="outsideUrl"></iframe>
</div>
</template>
......