javascript - 带有 laravel 的 bootstrap-vue.js 未知自定义元素:错误
问题描述
我是 Vuejs 新手,我收到错误未知自定义元素 -
我如何注册自定义元素 - b-alert。我认为这个元素来自 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
}
},
}
解决方案
您必须像在组件注册中一样注册组件
import { Alert } from 'bootstrap-vue/es/components';
components: { BAlert }
由于所有的html标签都被camelcase变成了虚线BAlert
='<b-alert>'
或者你也可以使用
components: { 'b-alert': BAlert }
推荐阅读
- reactjs - firebase 身份验证和 redux 调度
- html - 包含样式的外部 css
- visual-studio-code - vscode集成终端上的无用输出,使用MSVC和powershell 7
- leaflet - 使用草坪的多边形相交容差
- google-data-studio - 如何列出整个组织的所有谷歌数据工作室报告
- react-native-android - Yarn Run Build Fails , TypeError: _module.default.createRequireFromPath is not a function
- powershell - 如何通过 PS 远程访问多台远程计算机以发现一个特定的应用程序并确定每个远程设备上的版本号?无输出
- swift - 调用 didSelect 时如何切换自定义 xib 单元格?
- java - 如何更改 docker 镜像或容器中的 java 版本?
- python - 使用 DataFrame 创建条形图