一介书生
一介书生
  • 发布:2020-07-20 14:38
  • 更新:2021-07-15 17:06
  • 阅读:2111

钉钉h5微应用路由切换title不变

分类:uni-app

使用vue开发钉钉h5要在路由改变前设置一下钉钉内置浏览器的title,初次使用uni-app开发h5,请教下router怎么设置

2020-07-20 14:38 负责人:无 分享
已邀请:
一介书生

一介书生 (作者)

vue方式设置title
Vue.use(router);

new Vue({
router,
render: h => h(App)
}).$mount('#app');

router.beforeEach((to, from, next) => {
/ 路由发生变化修改页面title /
if (to.meta.title) {
document.title = to.meta.title
}
dd.ready(function() {
dd.biz.navigation.setTitle({
title: document.title,
onSuccess: function(result) {
// alert('succcess')
},
onFail: function(err) {}
})
})
next()
})

炒饭包子

炒饭包子

onShow() {  
    dd.setTitle({title: '标题'})  
}

该问题目前已经被锁定, 无法添加新回复