1
  1. Help to fix error:

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

(found in <Root>)

  1. Why I dont see this component app-page-test in vue tools?

enter image description here

Information.

I added component to a custom page in the laravel project.

test.blade.php

@extends('layouts.app')

@push('scripts')
    <script src="{{ asset('js/base/page/test/app.js') }}" defer></script>
@endpush

@section('content')
    <div id="pageTest">
        <app-page-test></app-page-test>
    </div>
@endsection

resources/js/base/page/test/app.js

import Vue from 'vue';
import App from './components/main';
import store from './store/index';

Vue.component(
    'app-page-test',
    App
);

new Vue({
    el: '#pageTest',
    store
});

resources/js/base/page/test/components/main.vue

<template>
    <div class="app-page-test">
        <p>test</p>
    </div>
</template>
<script>
export default {
    name: "app-page-test",
    mounted() {
        console.log('Component mounted.')
    }
}
</script>

1 Answer 1

1

try this way

import Vue from 'vue';
import App from './components/main';
import store from './store/index';
Vue.component('app-page-test', require('./components/AppPageTest.vue').default);

new Vue({
    el: '#pageTest',
    store, 
});
Sign up to request clarification or add additional context in comments.

3 Comments

Yes thank you. i deleted and re-created the whole project. The reason was never found, but now there are no errors.
@d-velop that' great so make sure you mark this answer so other will not spend time one this thanks
Hmm... the reason was never found. Even the source code works correctly in the new project. But thanks for trying to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.