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

时间:2019-11-26 00:36:12

标签: laravel vue.js

我不确定自己缺少什么,一切似乎都已正确设置:

app.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>

test.blade.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.

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,就我而言,我忘记了命令: Npm run watch

答案 1 :(得分:0)

在刀片模板中,您可以尝试以下操作:

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

然后执行npm run watch。

相关问题