• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

vue实现了select的下拉默认值 默认为option选中的问题


Recommended Posts

今天用vue实现选择下拉框时,发现用v-model绑定属性后,原来默认显示第一项的选择框变成了空白,在option标签页指定选中的属性没有任何作用。按照官网的情况再敲一次后,第一项还是默认不显示。网上查了一下,发现需要在生命周期钩子里设置参数。

Vue零部件

模板

div id=' v-模型-选择' class='演示'

select name=' ' id=' id1 ' v-model=' selected '

选项禁用值=' '请选择一个/选项

选项A/选项

选项B/选项

选项C/选项

选项D/选项

/选择

/div

/模板

Js零件

导出默认值{

data(){

返回{

选择了: ' '

}

},

已创建(){

this.selected=' '

}

}

Link to comment
Share on other sites