Skip to content

如何点击清空按钮的时候将select框里面的值恢复默认值,这里的默认值是全部 #576

@MissNanLan

Description

@MissNanLan
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.3.5

Environment

windows 7 64位,谷歌浏览器70.0.3538.110(正式版本(32 位),Vue 2.6

Reproduction link

https://vue.ant.design/components/select-cn/

Steps to reproduce

HTML

<a-select  :defaultValue="emotionList[0].name" class="filter-item_select" @change="handleEmotionChange">
<a-select-option  :value="item.value"  v-for="item in emotionList" :key="item.id" >{{item.name}}</a-select-option>
</a-select>
<a-button @click="clear">清空</a-button>

JSON

emotionList = [
{
name: "全部",
value: -1
},
{
name: "负面",
value: 0
},
{
name: "中性",
value: 1
},
{
name: "正面",
value: 2
}
];

What is expected?

期望能够 点击清空按钮的时候将select改变过的值恢复成默认值,这里的默认值是“全部”

What is actually happening?

清空按钮的方法不知道怎么写

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions