[Bug Report] How to set default value in el-option
- Dominant language
- Vue
- Stars
- 54k
- Forks
- 14.4k
- PR merge metrics
- No merged PRs in 30d
Description
### Element UI version
2.13.0
### OS/Browsers version
10 / chrome 80
### Vue version
3.0.0-alpha.6
### Reproduction Link
https://jsfiddle.net/mmx38qxw/
### Steps to reproduce
I want to know how can i set my saved value in database to `el-option` in edit page?

based on my image when i open my edit page i should get `Berat Unit (Kg)` as selected option.
# Code
`html`
```html
```
`script`
```javascript
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
site_url: process.env.MIX_APP_URL,
variants: [],
form: {
name: '',
photo: '',
active: '',
parent_id: '',
type: '',
_method: 'PUT',
},
}
},
created () {
this.fetchData()
},
methods: {
fetchData() {
axios
.get('/api/admin/variants/'+this.$route.params.id, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('access_token')
}
})
.then(response => {
this.form.name = response.data.data.name,
this.form.active = response.data.data.active,
this.variants = response.data.variants // here is my options list
})
.catch(function (error) {
console.log('error', error);
});
},
}
```
### What is Expected?
show saved value as selected option
### What is actually happening?
showing empty option by default.
Any idea?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.