Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router切换标题会闪 #37

Open
lenxuelenxue opened this issue Jul 12, 2019 · 8 comments
Open

router切换标题会闪 #37

lenxuelenxue opened this issue Jul 12, 2019 · 8 comments

Comments

@lenxuelenxue
Copy link

机型/系统/版本

小米/安卓/6.0
OPPO A5/安卓/8.1.0
Honor 9i/安卓/8.0.0

应用场景 应用版本信息

如: 在微信中打开
应用版本号: 7.0.5

代码

怎么引入的

main.js

Vue.use(require('vue-wechat-title'))

怎么使用的

router.js

const routes = [
 {
    path: '/goldMedalDoctor',
    name:'goldMedalDoctor',
    component: goldMedalDoctor,
    meta: {
      title: '金牌医生计划'
    }
  },
  {
    path: '/inviteRewardDetail',
    name:'inviteRewardDetail',
    component: inviteRewardDetail,
    meta: {
      title: '邀请奖励明细'
    }
]

App.vue

<router-view v-wechat-title="$route.meta.title"></router-view>
      <div v-wechat-title="$route.meta.title" img-set="/static/img/logo.png"></div>

是否使用websocket或者其他跨域请求

没有

与预期不符的情况

从金牌医生计划跳转到邀请奖励明细,再返回金牌医生计划时,页面标题会先出现然后消失,加载完页面后,页面标题又会出现一次,而oppo手机加载页面过程中标题位置会先出现页面路径,再出现页面标题

如果浏览器报错了 报什么错了?
没有报错

@lenxuelenxue
Copy link
Author

而且页面刷新的时候,先出现页面路径url,再出现页面标题。

@deboyblog
Copy link
Owner

你页面模版本身需要有标题 这个插件的作用仅仅是在加载完成后去变更标题 但是网页初始化时是按照你的html内容读取的title信息

@lenxuelenxue
Copy link
Author

页面本身没有设置标题

@deboyblog
Copy link
Owner

@lenxuelenxue 你先给网页设置一个默认标题 可以是产品名称 再对比结果

@lenxuelenxue
Copy link
Author

设置了默认标题,从金牌医生计划跳转邀请奖励明细,再返回金牌医生计划,页面标题是这么变化的:金牌医生,然后是设置的默认标题,再然后是金牌医生。

@deboyblog
Copy link
Owner

你的意思是设置了默认标题后 插件传递的标题不生效了?

@lenxuelenxue
Copy link
Author

生效啊,就是在返回时,会先显示插件传递的标题,再显示默认标题,再显示插件传递的标题,所以中间会闪一下

@deboyblog
Copy link
Owner

你可以在app初始化完成后 将html的titile设置为空

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants