最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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
             }

     },

}

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
             }

     },

}

Share Improve this question asked Jul 18, 2018 at 20:05 Naishu BabuNaishu Babu 612 silver badges14 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You will have to register the ponent as in Component registration

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

ponents: { BAlert }

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

Alertenativly you can also use

ponents: { 'b-alert': BAlert }
发布评论

评论列表(0)

  1. 暂无评论