去掉语音转换时的reload,用事件取代
Showing
9 changed files
with
55 additions
and
13 deletions
... | @@ -98,7 +98,13 @@ export default { | ... | @@ -98,7 +98,13 @@ export default { |
98 | mounted() { | 98 | mounted() { |
99 | this.initData(); | 99 | this.initData(); |
100 | }, | 100 | }, |
101 | created() { }, | 101 | created() { |
102 | this.$root.eventBus.$on("langChange", () => { | ||
103 | try { | ||
104 | this.tips = this.i18n.customService.unauth[this.tipModel]; | ||
105 | } catch (e) { } | ||
106 | }); | ||
107 | }, | ||
102 | watch: { | 108 | watch: { |
103 | userInfo(val) { | 109 | userInfo(val) { |
104 | if (val && val.name) { | 110 | if (val && val.name) { | ... | ... |
... | @@ -13,30 +13,31 @@ export default { | ... | @@ -13,30 +13,31 @@ export default { |
13 | return { | 13 | return { |
14 | activeIndex: 0, | 14 | activeIndex: 0, |
15 | sTitle: this.dataObj && this.dataObj.name || '', | 15 | sTitle: this.dataObj && this.dataObj.name || '', |
16 | reloadBlackList: [] | ||
16 | }; | 17 | }; |
17 | }, | 18 | }, |
18 | props: { | 19 | props: { |
19 | type: { | 20 | type: { |
20 | type: String, | 21 | type: String, |
21 | default () { | 22 | default() { |
22 | return "nav"; | 23 | return "nav"; |
23 | } | 24 | } |
24 | }, | 25 | }, |
25 | dataObj: { | 26 | dataObj: { |
26 | type: Object, | 27 | type: Object, |
27 | default () { | 28 | default() { |
28 | return {}; | 29 | return {}; |
29 | } | 30 | } |
30 | }, | 31 | }, |
31 | dataList: { | 32 | dataList: { |
32 | type: Array, | 33 | type: Array, |
33 | default () { | 34 | default() { |
34 | return []; | 35 | return []; |
35 | } | 36 | } |
36 | }, | 37 | }, |
37 | labelProperty: { | 38 | labelProperty: { |
38 | type: String, | 39 | type: String, |
39 | default () { | 40 | default() { |
40 | return "name"; | 41 | return "name"; |
41 | } | 42 | } |
42 | } | 43 | } |
... | @@ -81,10 +82,15 @@ export default { | ... | @@ -81,10 +82,15 @@ export default { |
81 | // 如果是语言设置,则设置语言 | 82 | // 如果是语言设置,则设置语言 |
82 | let lang = curData.value; | 83 | let lang = curData.value; |
83 | if (lang != localStorage.getItem('lang')) { | 84 | if (lang != localStorage.getItem('lang')) { |
84 | // this.$i18n.locale = lang; | ||
85 | // this.sTitle = curData.name; | ||
86 | localStorage.setItem("lang", lang); | 85 | localStorage.setItem("lang", lang); |
86 | if (this.reloadBlackList.indexOf(this.$route.path) >= 0) { | ||
87 | window.location.reload(); | 87 | window.location.reload(); |
88 | } else { | ||
89 | this.$i18n.locale = lang; | ||
90 | this.sTitle = curData.name; | ||
91 | this.$root.eventBus.$emit("langChange"); | ||
92 | } | ||
93 | // console.log(this.$route); | ||
88 | } | 94 | } |
89 | } else { | 95 | } else { |
90 | // if (curData.value == "logout") { | 96 | // if (curData.value == "logout") { |
... | @@ -171,5 +177,5 @@ export default { | ... | @@ -171,5 +177,5 @@ export default { |
171 | return this.dataList[this.activeIndex][this.labelProperty]; | 177 | return this.dataList[this.activeIndex][this.labelProperty]; |
172 | } | 178 | } |
173 | }, | 179 | }, |
174 | created() {}, | 180 | created() { }, |
175 | }; | 181 | }; | ... | ... |
... | @@ -67,7 +67,7 @@ export default { | ... | @@ -67,7 +67,7 @@ export default { |
67 | this.dropdownMVisible = true; | 67 | this.dropdownMVisible = true; |
68 | } else if (evtStr == 'login') { | 68 | } else if (evtStr == 'login') { |
69 | this.loginMVisible = true; | 69 | this.loginMVisible = true; |
70 | } else {} | 70 | } else { } |
71 | }, | 71 | }, |
72 | checkIsSmallScreen() { | 72 | checkIsSmallScreen() { |
73 | const self = this; | 73 | const self = this; |
... | @@ -122,7 +122,9 @@ export default { | ... | @@ -122,7 +122,9 @@ export default { |
122 | // self.checkIsSmallScreen(); | 122 | // self.checkIsSmallScreen(); |
123 | // } | 123 | // } |
124 | window.addEventListener('resize', () => this.checkIsSmallScreen(), false); | 124 | window.addEventListener('resize', () => this.checkIsSmallScreen(), false); |
125 | 125 | this.$root.eventBus.$on("langChange", () => { | |
126 | this.initData(); | ||
127 | }); | ||
126 | }, | 128 | }, |
127 | watch: { | 129 | watch: { |
128 | userInfo(val) { | 130 | userInfo(val) { | ... | ... |
... | @@ -247,5 +247,11 @@ export default { | ... | @@ -247,5 +247,11 @@ export default { |
247 | mounted() { | 247 | mounted() { |
248 | this.initData(); | 248 | this.initData(); |
249 | }, | 249 | }, |
250 | created() { } | 250 | created() { |
251 | this.$root.eventBus.$on("langChange", () => { | ||
252 | try { | ||
253 | this.initData(); | ||
254 | } catch (e) { } | ||
255 | }); | ||
256 | } | ||
251 | } | 257 | } | ... | ... |
... | @@ -79,5 +79,11 @@ export default { | ... | @@ -79,5 +79,11 @@ export default { |
79 | created() { | 79 | created() { |
80 | document.documentElement.scrollTop = 0; | 80 | document.documentElement.scrollTop = 0; |
81 | document.body.scrollTop = 0; | 81 | document.body.scrollTop = 0; |
82 | |||
83 | this.$root.eventBus.$on("langChange", () => { | ||
84 | try { | ||
85 | this.initData(); | ||
86 | } catch (e) { } | ||
87 | }); | ||
82 | } | 88 | } |
83 | } | 89 | } | ... | ... |
... | @@ -72,5 +72,10 @@ export default { | ... | @@ -72,5 +72,10 @@ export default { |
72 | document.documentElement.scrollTop = 0; | 72 | document.documentElement.scrollTop = 0; |
73 | document.body.scrollTop = 0; | 73 | document.body.scrollTop = 0; |
74 | this.initData(); | 74 | this.initData(); |
75 | this.$root.eventBus.$on("langChange", () => { | ||
76 | try { | ||
77 | this.initData(); | ||
78 | } catch (e) { } | ||
79 | }); | ||
75 | } | 80 | } |
76 | } | 81 | } | ... | ... |
... | @@ -599,6 +599,8 @@ export default { | ... | @@ -599,6 +599,8 @@ export default { |
599 | } | 599 | } |
600 | }, | 600 | }, |
601 | }, | 601 | }, |
602 | beforeDestroy() { | ||
603 | }, | ||
602 | created() { | 604 | created() { |
603 | this.initData(); | 605 | this.initData(); |
604 | try { | 606 | try { |
... | @@ -609,5 +611,10 @@ export default { | ... | @@ -609,5 +611,10 @@ export default { |
609 | this.$root.eventBus.$on("/register", () => { | 611 | this.$root.eventBus.$on("/register", () => { |
610 | this.type = 1; | 612 | this.type = 1; |
611 | }); | 613 | }); |
614 | this.$root.eventBus.$on("langChange", () => { | ||
615 | try { | ||
616 | this.initData(); | ||
617 | } catch (e) { } | ||
618 | }); | ||
612 | } | 619 | } |
613 | } | 620 | } | ... | ... |
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | 4 | ||
5 | <auth @onLogout="userLogout" v-show="false"></auth> | 5 | <auth @onLogout="userLogout" v-show="false"></auth> |
6 | 6 | ||
7 | <iframe sandbox="allow-top-navigation" v-if="outsideUrl" id="myiframe" width="100%" height="100%" scrolling="yes" frameborder="0" :src="outsideUrl"></iframe> | 7 | <iframe v-if="outsideUrl" id="myiframe" width="100%" height="100%" scrolling="yes" frameborder="0" :src="outsideUrl"></iframe> |
8 | </div> | 8 | </div> |
9 | </template> | 9 | </template> |
10 | 10 | ... | ... |
-
Please register or sign in to post a comment