最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue報(bào)錯(cuò)Component?name"Home"should?always?be?multi問題

 更新時(shí)間:2022年09月01日 10:12:51   作者:清風(fēng)細(xì)雨_林木木  
這篇文章主要介紹了Vue報(bào)錯(cuò)Component?name"Home"should?always?be?multi問題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

Vue報(bào)錯(cuò)Component name"Home"should always be multi

原因

報(bào)錯(cuò)的大概意思是: 組件名“Home”應(yīng)該總是多字的vue/多字的組件名

解決辦法

package.json

"vue/multi-word-component-names": 0 // 多字符組件名稱,不設(shè)置檢測(cè)

如圖

看了網(wǎng)上很多人都去把eslint關(guān)了╮(╯▽╰)╭

個(gè)人建議千萬不要,團(tuán)隊(duì)開發(fā)eslint是一定要開的,至于為什么自己可以找點(diǎn)資料看一下。

vue常見錯(cuò)誤解決

最近在做vue項(xiàng)目的時(shí)候遇到了幾個(gè)報(bào)錯(cuò),這幾個(gè)報(bào)錯(cuò)在vue項(xiàng)目還算常見,因此記錄下來解決方法。

Error in render: “TypeError: Cannot read property ‘list’ of undefined”

報(bào)錯(cuò): 渲染錯(cuò)誤:“未定義的Type Error:無法讀取屬性”列表

原因: 沒給list定義,也就是說在temple中用到list了,但是在data中沒定義這個(gè)字段,如果已經(jīng)定義了但是還是報(bào)錯(cuò),請(qǐng)檢查下自己是否拼錯(cuò)了單詞,因?yàn)槲揖褪沁@么蠢了= =

解決:

data () {
? return {
? ? list: []
? }
},

[Vue warn]: Property or method “message” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property

報(bào)錯(cuò): message沒定義

原因: 跟上面的一樣,message在data那里沒有定義,定義一個(gè)初始值就好

解決:

data() {
?return {
? ? ?message: ''
? }
},

Module build failed: Error: No parser and no file path given, couldn’t infer a parser.

報(bào)錯(cuò): 沒有語法分析器和文件路徑,無法推斷解析器

原因: 依賴包出現(xiàn)問題,prettier 一個(gè)vue-cli的依賴,把一個(gè)feature 的移除當(dāng)作次版本發(fā)布

解決: npm install --save-dev prettier@1.12.0(刪除 node_modules下_prettier@1.13.0@prettier文件夾)

routes forEach is not a function

原因: forEach routes沒有發(fā)現(xiàn)里面有值

解決:

1.查看import {routes} from './routes’這個(gè)路徑是否正確

2.routes是一個(gè)數(shù)組,檢查routes是否是一個(gè)數(shù)組

3.是否已經(jīng)new了一個(gè)router,又再次new一遍?

// main.js
// 路由配置
const RouterConfig = {
? // 使用HTML5的History模式
? mode: 'history',
? routes: Routers
}
// new VueRouter
const router = new VueRouter(RouterConfig)


// router.js
// 在router中又再次new一遍,重復(fù)了?。。?!
export default new Router({
? routes: [
? ? {
? ? ? path: '/',
? ? ? name: 'home',
? ? ? component: home
? ? }
? ]
})

改為:
// router.js
const routers = [
? {
? ? path: '/home',
? ? meta: {
? ? ? title: '主頁'
? ? },
? ? component: (resolve) => require(['../page/home.vue'], resolve)
]
export default routers

[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the “name” option.

原因: 被引用的組件頁面沒有進(jìn)行export,導(dǎo)致尋找不到瀏覽器console報(bào)錯(cuò),但是編譯的時(shí)候沒有語法問題不報(bào)錯(cuò)

解決:

export { default as AppMain } from './AppMain'

TypeError: Cannot read property ‘vue’ of undefined

報(bào)錯(cuò)信息:ERROR in ./src/login.vue Module build failed (from ./node_modules/_vue-loader@13.7.3@vue-loader/index.js): TypeError: Cannot read property ‘vue’ of undefined at Object.module.exports (F:\VistualStudioCode\threess\node_modules_vue-loader@13.7.3@vue-loader\lib\load er.js:61:18) @ ./src/main.js 7:13-35 @ multi ./node_modules/_webpack-dev-server@3.1.10@webpack-dev-server/client?http://localhost:3000 (webpack)/h ot/dev-server.js ./src/main.js

原因: vue-loader這個(gè)插件被破壞了

解決:

// 重新安裝依賴
npm install vue-loader@latest --save-dev

route內(nèi)的query參數(shù)沒有實(shí)時(shí)監(jiān)聽,放在data中

報(bào)錯(cuò)信息: 導(dǎo)致query參數(shù)改變之后,頁面并沒有發(fā)生變化

解決:

? watch: {
? ? $route: {
? ? ? handler (newVal, oldVal) {
? ? ? ? this.isBindInfo = newVal.query.isBindInfo
? ? ? ? this.isRealName = newVal.query.isRealName
? ? ? ? this.sessionId = newVal.query.sessionId
? ? ? ? this.showNo = newVal.query.showNo
? ? ? ? // 判斷newVal有沒有值監(jiān)聽路由變化
? ? ? },
? ? ? deep: true,
? ? },

? },

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

怀安县| 百色市| 临清市| 城口县| 舞阳县| 平原县| 台南市| 额尔古纳市| 陆川县| 应用必备| 广汉市| 油尖旺区| 嵊泗县| 宁远县| 隆德县| 宜兴市| 锡林浩特市| 丹寨县| 库车县| 三穗县| 宁南县| 简阳市| 南城县| 潮州市| 湛江市| 灵山县| 苍南县| 巴林右旗| 抚松县| 府谷县| 蕉岭县| 新密市| 长葛市| 五原县| 岳阳县| 行唐县| 贵港市| 积石山| 福海县| 九寨沟县| 报价|