ios 微信端是window.onload才触发document.title的修改,这里增加一个iframe做缓冲触发onload事件,触发后移除onload事件,清除iframe组件。
created:function(){
document.title="你的标题";
var iframe = document.createElement('iframe');
iframe.style.cssText = 'display: none; width: 0; height: 0;';
iframe.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
var listener = function() {
setTimeout(function(){
iframe.removeEventListener('load', listener);
setTimeout(function(){
document.body.removeChild(iframe);
}, 0);
}, 0);
};
iframe.addEventListener('load', listener);
document.body.appendChild(iframe);
}