记录vue中遇到的坑(不管是组件ele组件还是vue本身)
Element 组件中的bug 寻找地址:
https://gitter.im/ElemeFE/element?at=586f69965ffdeea723124c44
1.Element el-radio-group 的坑
<html>
<head>
<meta charset="UTF-8">
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-default/index.css">
</head>
<body>
<div id="app">
<el-radio-group v-model="radio2">
<el-radio :label="a">备选项</el-radio>
<el-radio :label="b">备选项</el-radio>
<el-radio :label="c">备选项</el-radio>
</el-radio-group>
</div>
</body>
<!-- 先引入 Vue -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data: function(){
return { radio2: 'c'}
}
})
</script>
</html>
解决:
方法一:
<el-radio-group v-model="radio2">
<el-radio :label="'a'">备选项</el-radio>
<el-radio :label="'b'">备选项</el-radio>
<el-radio :label="'c'">备选项</el-radio>
</el-radio-group>
方法二:
<el-radio-group v-model="radio2">
<el-radio label="a">备选项</el-radio>
<el-radio label="b">备选项</el-radio>
<el-radio label="c">备选项</el-radio>
</el-radio-group>
网友评论