解决支付宝iOS不能修改标题
- 引入文件 antbridge.min.js (文档说明)
- 文件地址 https://a.alipayobjects.com/g/component/antbridge/1.1.4/antbridge.min.js
- 设置标题:
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title;
const userAgent = window.navigator.userAgent.toLowerCase();
if (/AlipayClient/i.test(userAgent) && ant) {
ant.setTitle(to.meta.title);
}
}
next();
});
作者: Gump8