vue製作網站的問題及解決辦法

一、vue使用路由跳轉後,頁面不置頂

配置路由index.js時,增加

export default new Router({

  scrollBehavior(to,from,saveTop){
    if(saveTop){
      return saveTop;
    }else{
      return {x:0,y:0}
    }
  },

  routes:[...]
})

二、vue項目上線後,頁面提示在360瀏覽器中樣式顯示不正確

1、強制使用IE瀏覽器最高版本,默認用極速內核

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="renderer" content="webkit"> 

2、頁面提示“Vuex requires a Promise polyfill in this browser”錯誤

安裝babel-polyfill插件

npm install babel-polyfill --save-g

在main.js中引入插件

import 'babel-polyfill'

 

三、vue頁面刷新後提示cannot get

取消index.js配置裏的mode:'history'

export default new Router({
  //mode:'history',

  routes: [...]
})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章