iT邦幫忙

0

使用vue 和vue-router 頁面重整導頁問題

問題描述如下
建立一個index.html檔,並在其中引入vue, vue-router和httpVueLoader(編譯vue檔案) cdn ,並deploy到IIS上

1.router模式是history在使用vue-router做頁面跳轉時網址列改變如下

locahot:81/dist/index.html ==> localhost:81/dist/dashboard  

2.在dashboard頁面重新整理時,因為實際沒有這頁會出現404,這個部分參考官網下載 IIS UrlRewrite並做好設定(現在重整時的網址列)

locahot:81/dist/dashboard ==> localhost:81/dist/dashboard(呈現index.html內的component)  

最後結果:確實會導頁到index.html,但是顯示的是index.html的component

  • 應該都放在index.html然後用v-if去做控制嗎?
  • 有甚麼方法可以直接顯示原本的component?

努力自學vue中,很多觀念還在慢慢補強,任何指導和糾正,不勝感激
我將index.html和web.config.js放到網址
https://jsfiddle.net/nL6fgj4c/1/

samshum iT邦新手 5 級 ‧ 2021-03-28 01:39:02 檢舉
https://www.youtube.com/watch?v=gvWZLxGYKws&list=PLwDQt7s1o9J57JQNXG7UooKI3Kpzw9fkj&index=30
這套教學很吊
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答