Naishu Babu
Naishu Babu

Reputation: 61

bootstrap-vue.js with laravel Unknown custom element: <b-alert> error

Im new to Vuejs and I get the error unknown custom element -

how do i register a custom element - b-alert. I think this element is from bootstrapVue.

<template>
<div>
 <b-alert show>Default Alert</b-alert>



  </div> 
   </template>

    <script>
   export default {
    data () {
            return {
                 dismissSecs: 10,
                 dismissCountDown: 0,
                 showDismissibleAlert: false
            }
    },
                  methods: {
             countDownChanged (dismissCountDown) {
                     this.dismissCountDown = dismissCountDown
             },
             showAlert () {
                     this.dismissCountDown = this.dismissSecs
             }

     },

}

Upvotes: 0

Views: 4634

Answers (1)

Crackers
Crackers

Reputation: 1125

You will have to register the component as in Component registration

import { Alert } from 'bootstrap-vue/es/components';

components: { BAlert }

Since all html tags are turned into dashed by camelcase BAlert = '<b-alert>'

Alertenativly you can also use

components: { 'b-alert': BAlert }

Upvotes: 6

Related Questions