Tips
1.命名規(guī)范:
一是不使用非法的標(biāo)簽字符;二是不與 HTML 元素(區(qū)分大小寫)或 SVG 元素(不區(qū)分大小寫)重名;三是不使用 Vue 保留的 slot 和 component(區(qū)分大小寫)。
2.這種情況一般是引入的相關(guān)組件路徑錯(cuò)誤
ERROR Failed to compile with 1 errors
This relative module was not found:
3.每一個(gè)需要在頁面上使用的內(nèi)容需要在components中注冊
4.如何去除url中的#號,參考:
知乎
VueRouter路由配置
5.如何在組件屬性中拼接字符串
sf論壇
6.報(bào)錯(cuò)信息
- tag <div> has no matching end tag.
頁面中有元素沒匹配上
7.如何監(jiān)聽window.scroll事件
mounted(){
window.addEventListener('scroll',() => {
var scrollTop = document.body.scrollTop;
scrollTop > 3000 ? this.isShowTabs = true : this.isShowTabs = false;
scrollTop > 100 ? this.isShowLinks = true : this.isShowLinks = false;
scrollTop > 1000 ? this.isShowGoTop = true : this.isShowGoTop = false;
});
},
8.vue-router中設(shè)置HistoryMode時(shí)
vue-router設(shè)置mode=history時(shí)
會出現(xiàn)以下情況:
url為: https://yourwebsit/index.html?Id
對應(yīng)的頁面一片空白,對應(yīng)的app里的組件未生成.
app中組件未生成