【发布时间】:2019-11-08 02:40:45
【问题描述】:
我有以下代码:
<template>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-outline-dark active">
<input type="radio" name="grp" v-model="channel" value="vh1" checked> VH1
</label>
<label class="btn btn-outline-dark">
<input type="radio" name="grp" v-model="channel" value="mtv"> MTV
</label>
</div>
</template>
<script>
export default {
data() {
return {
channel: 'mtv'
}
},
watch: {
channel: function(newValue) {
console.log('value has been changed to ' + newValue);
}
}
}
</script>
当我单击单选按钮时,什么也没有发生。但是,当我删除样式的“data-toggle="buttons" 属性时,它就开始工作了!谁能帮我在这里找到工作?
编辑
对于那些不知道的人,data-toggle 来自引导按钮插件,它为您正在制作的按钮添加了额外的样式和功能。在此处查看文档: https://getbootstrap.com/docs/4.0/components/buttons/#toggle-states
【问题讨论】:
标签: vuejs2 bootstrap-4