美文网首页
iviewui的 一些 乱知识

iviewui的 一些 乱知识

作者: undefined汪少 | 来源:发表于2019-05-19 17:01 被阅读0次

 1  , 在 strot ----下面 app.js

state: {

  //是否是首页,默认显示小头

  isHomePage:false

},

mutations: {

// 设置是否是首页的状态

  setIsHomePage(state, status) {

state.isHomePage = status

}

},

2.在 router.JS  index.JS里面 判断

router.afterEach(to => {

let path = to.path

  if ('/home' == path ||'/' == path ||'/fxglhome' == path) {

store.commit('setIsHomePage', true)

}else {

store.commit('setIsHomePage', false)

}

setTitle(to, router.app)

// iView.LoadingBar.finish()

  window.scrollTo(0, 0)

})

3,在自己的页面 main.vue 

computed: {

//计算是否当前页面是首页,用来替换头部内容区域

homeHeader() {

return this.$store.state.app.isHomePage

}}

相关文章

网友评论

      本文标题:iviewui的 一些 乱知识

      本文链接:https://www.haomeiwen.com/subject/dueqzqtx.html