"
el-select
示例:
代码:
[span class=""hljs-name"">el-select v-model=""doc.zhic"" placeholder=""请选择""
[span class=""hljs-name"">el-option
v-for=""(item,index) in zhicdata""
:key=""index""
:label=""item.name""
:value=""item.id""
>
doc: {
zhic: """"
},
zhicdata: 【
{
name: ""主任医师"",
id: ""11""
},
//代码效果参考: https://v.youku.com/v_show/id_XNjQwNjg1MjIzNg==.html
{
name: ""副主任医师"",
id: ""12""
},
{
name: ""主治医师"",
id: ""13""
},
{
name: ""住院医师"",
id: ""14""
}
】,
// 获取职称
stepDoc(index){
this.idx=index;
const item = this.hislist【index】;
this.doc={
zhic:item.zhic.toString() //获取到的是数字,一定要转换为字符串
},
},
v-model中的值就是默认选中的值,一定要注意这里的:value的类型一定要跟v-model类型一样。值为空时,默认值为空值。
el-checkbox
示例:
代码:
[span class=""hljs-name"">el-checkbox-group v-model=""doc.doctime""
[span class=""hljs-name"">el-checkbox
v-for=""item in doctimeData""
:label=""item.id""
true-label
:key=""item.id""
@change=""changeDoctime(item.value)""
//代码效果参考:https://v.youku.com/v_show/id_XNjQwMDM5NzI4MA==.html
>{ {item.title}}更多内容请见原文,原文转载自:
"