more
more

Reputation: 133

Vue warning: Unknown custom element

i had this error

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

my add-video.blade.php

        <div class="panel panel-default">
        <div class="panel-heading">Add Video!</div>
        <div class="panel-body">
        <addVideo></addVideo>
    </div>

addVideo.vue

 <template lang="html">
  //template codes
</template>

<script>
export default {

  data(){

    return {
      errors:[],
      video : {
        name : '',
        rate : '',
        year : '',
        description : '',
        creator : '',
        director : '',
        writers : '',
        storyline : '',
        isMovie : '',
        season : ''
      }
    }


  },

  created(){
    this.fetchVideos();
  },

  methods:{
    fetchVideos(){
      axios.get('videos').then(response=>{

        this.video = response.data.video;
      });

    },
    addVideo(){

      axios.post('videos',this.videos).then(response =>{
        this.videos.push(response.data.video);
        this.video = {
          name : '',
          rate : '',
          year : '',
          description : '',
          creator : '',
          director : '',
          writers : '',
          storyline : '',
          isMovie : '',
          season : ''
        };
        console.log(response.data);
      },response=>{
          this.errors=response.data;
      });

    }

  }




}
</script>

<style lang="css">
</style>

app.js

import Vue from 'vue';
import Users from './components/Users.vue';
import Register from './components/Register.vue';
import addVideo from './components/addVideo.vue';




window.axios = require('axios');


const app = new Vue({
    el: '#app',
    components : { Users,Register,addVideo }
});

Laravel 5.4 project .I coded same code for different components.Same code works other component.I think have not syntax error.but i didn't find my fault.I hope shared piece of code helpful for you.

Upvotes: 3

Views: 4189

Answers (1)

FitzFish
FitzFish

Reputation: 8629

Actually, html tags are not case-sensitive, everything is lowered. Use hyphen notation instead to have an equivalent to an addVideo in your template (as long as it is in a .php or an .html file):

<add-video></add-video>

Upvotes: 7

Related Questions