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() { document.title = state.title;
//利用iframe的onload事件刷新页面 // 如果是 iOS 设备,则使用如下 hack 的写法实现页面标题的更新
document.title = state.title; if (/ip(hone|od|ad)/i.test(navigator.userAgent.toLowerCase())) {
var iframe = document.createElement('iframe'); const hackIframe = document.createElement('iframe');
iframe.style.visibility = 'hidden'; hackIframe.style.display = 'none';
iframe.style.width = '1px'; hackIframe.src = '/public/fixIosTitle.html?r=' + Math.random();
iframe.style.height = '1px'; document.body.appendChild(hackIframe);
iframe.onload = function() { setTimeout(() => {
setTimeout(function() { document.body.removeChild(hackIframe);
document.body.removeChild(iframe); }, 300);
}, 0); }
};
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