コンポーネントをパッケージするときにエラーが発生しました.
プロジェクトルーティングを構成するときにrouter-viewを使用して正常にレンダリングできない場合、[Vue warn]:Unknown custom element:-did you register the component correctly?For recursive components, make sure to provide the “name” option.
found in
—> at src/App.vue
以下のルーティングプロファイルindexを確認する.js:
书き方は正确で、その后グループのお兄さん达に教えてもらった后、入り口のファイルmainを発见しました.js中
コンポーネントを登録するのを忘れました!!!
変更後は次のようになります.
このような頭のない小さな間違いは自分が二度と犯さないことを望んでいる.
found in
—> at src/App.vue
以下のルーティングプロファイルindexを確認する.js:
import Vue from 'vue'
import VueRouter from 'vue-router'
//
const Home=()=>import('../views/home/Home.vue')
const Category=()=>import('../views/category/Category.vue')
const Cart=()=>import('../views/cart/Cart.vue')
const Profile=()=>import('../views/profile/Profile.vue')
Vue.use(VueRouter)
const routes=[
{
path:'',
redirect:'/home'
},
{
path:'/home',
component:Home
},
{
path:'/category',
component:Category
},
{
path:'/cart',
component:Cart
},
{
path:'/profile',
component:Profile
},
]
const router =new VueRouter({
routes
})
export default router
书き方は正确で、その后グループのお兄さん达に教えてもらった后、入り口のファイルmainを発见しました.js中
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
render: h => h(App)
})
コンポーネントを登録するのを忘れました!!!
変更後は次のようになります.
import Vue from 'vue'
import App from './App'
import router from './router'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
render: h => h(App)
})
このような頭のない小さな間違いは自分が二度と犯さないことを望んでいる.