Commit 7e9b19c4 authored by FE-安焕焕's avatar FE-安焕焕 👣

fix:页面title不变的问题

parent c74eb32d
...@@ -40,20 +40,17 @@ const mutations = { ...@@ -40,20 +40,17 @@ const mutations = {
if (title) { if (title) {
state.title = title; state.title = title;
} }
setTimeout(function() {
//利用iframe的onload事件刷新页面
document.title = state.title; document.title = state.title;
var iframe = document.createElement('iframe'); // 如果是 iOS 设备,则使用如下 hack 的写法实现页面标题的更新
iframe.style.visibility = 'hidden'; if (/ip(hone|od|ad)/i.test(navigator.userAgent.toLowerCase())) {
iframe.style.width = '1px'; const hackIframe = document.createElement('iframe');
iframe.style.height = '1px'; hackIframe.style.display = 'none';
iframe.onload = function() { hackIframe.src = '/public/fixIosTitle.html?r=' + Math.random();
setTimeout(function() { document.body.appendChild(hackIframe);
document.body.removeChild(iframe); setTimeout(() => {
}, 0); document.body.removeChild(hackIframe);
}; }, 300);
document.body.appendChild(iframe); }
}, 0);
}, },
[types.CHANGE_META](state, meta) { [types.CHANGE_META](state, meta) {
for (let i in meta) { for (let i in meta) {
......
...@@ -71,10 +71,8 @@ export default { ...@@ -71,10 +71,8 @@ export default {
async goOrderList(type) { async goOrderList(type) {
if (type === 'cs') { if (type === 'cs') {
this.$store.commit('CHANGE_TITLE', '客服中心'); // 改变title this.$store.commit('CHANGE_TITLE', '客服中心'); // 改变title
setTimeout(() => {
window.location.href = window.location.href =
'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod2.html'; 'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod2.html';
}, 0);
return; return;
} }
const token = localStorage.get('vccToken'); const token = localStorage.get('vccToken');
......
...@@ -190,10 +190,8 @@ export default { ...@@ -190,10 +190,8 @@ export default {
}, },
contractCS() { contractCS() {
this.$store.commit('CHANGE_TITLE', '客服中心'); // 改变title this.$store.commit('CHANGE_TITLE', '客服中心'); // 改变title
setTimeout(() => {
window.location.href = window.location.href =
'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod2.html'; 'https://kdspstatic.91xr.cn/kdsp/mine/service/customer-service/customer-service-prod2.html';
}, 0);
}, },
openCancelPopup() { openCancelPopup() {
this.$dialog({ this.$dialog({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment