简体   繁体   中英

Laravel, VueJS [Vue warn]: Unknown custom element: did you register the component correctly?

I'm not sure what I am missing, everything seems to be set up correctly:

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

Doubled checked the spelling but still get

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.

In your blade template you can try this:

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

Then execute npm run watch.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM