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

六月ゝ 毕业季﹏ 提交于 2020-06-17 15:23:21

问题


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
             }

     },

}


回答1:


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 }


来源:https://stackoverflow.com/questions/51410184/bootstrap-vue-js-with-laravel-unknown-custom-element-b-alert-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!