Laravel,VueJS [Vue 警告]:未知的自定义元素:你是否正确注册了组件?



我不确定我错过了什么,一切似乎都设置正确:

应用.js

window.Vue = require('vue');

import CategoriesDataTable from './components/categories/CategoriesDataTable.vue';
const app = new Vue({
el: '#app',
components : {
CategoriesDataTable,
},
});

CategoriesDataTable.vue:

<template>
<section class="table-container">
<table>
<thead></thead>
</table>
</section>
</template>
<script>
export default {
name : 'CategoriesDataTable',
data() {
return {}
}
}
</script>
<style>
</style>

测试刀片.php

@extends('master')
@section('title', 'Add Category')
@section('app')
<CategoriesDataTable></CategoriesDataTable>
@endsection

加倍检查拼写,但仍然得到

app.js:37926 [Vue warn]: Unknown custom element: <categoriesdatatable> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

在边栏选项卡模板中,可以尝试此操作:

<categories-data-table></categories-data-table>

然后执行 npm 运行监视。

我遇到了同样的问题,在我的情况下我忘记了命令: Npm 运行手表

最新更新