1. 程式人生 > >vue 打包的問題空白

vue 打包的問題空白

vue 路由分為hash(預設是hash)和history 

1.當時hash模式,當打包後是空白的,這是因為你的config檔案下index.js檔案,build物件下沒有改成 assetsPublicPath: './',

2.當是history模式的時候,打包後放在ngnix下面,會有404的錯誤

    (1).404的解決方案

        在ngnix配置  config 下面index.js
        location / {
            root   html;
            index  index.html index.htm;
            try_files $uri $uri/ /index.html;
        }

        (2)巢狀子路由出現子路由

                 子路由不能正常顯示
                 assetsPublicPath: '/',