亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - How to make ElementUI Select component selected by default?
高洛峰
高洛峰 2017-06-26 10:52:36
0
4
1032

How to select the ElementUI Select component by default?

The data in these options are dynamically captured, but now I need to set one of the options to the default value.
If the current page is edited by the user, after I obtain the user's parameters through ajax, how do I set the user's parameters as default in the options?

Attached js code:

<script>
    export default {
        name: 'edit',
        created (){

            this.$http.get('xxxxxx/api/getUserAttributes').then( resolve => {
                this.departments = resolve.data.departments
                this.userlevels = resolve.data.userlevels
                this.positions = resolve.data.positions
            }, reject => {
                this.$message.error('error')
            })

            let query_id = this.$route.query.id ? this.$route.query.id : 30

            this.$http.get('xxxxxx/api/getUser', {
                params: {
                    query_id: query_id
                }
            }).then( resolve => {
                this.form.id = resolve.data[0].id
                this.form.account = resolve.data[0].account
                this.form.password = resolve.data[0].password
                this.form.nickname = resolve.data[0].nickname
                this.form.email = resolve.data[0].email
            }, reject => {
                this.$message.error('error')
            })


        },
        data (){
            return {
                form: {
                    id: '',
                    account: '',
                    nickname: '',
                    password: '',
                    email: '',
                    sex: 1,
                    authority: []
                },
                departments: [],
                userlevels: [],
                positions: []
            }
        }
    }
</script>
高洛峰
高洛峰

擁有18年軟件開發(fā)和IT教學(xué)經(jīng)驗(yàn)。曾任多家上市公司技術(shù)總監(jiān)、架構(gòu)師、項(xiàng)目經(jīng)理、高級(jí)軟件工程師等職務(wù)。 網(wǎng)絡(luò)人氣名人講師,...

reply all(4)
小葫蘆

Make the value of v-model correspond to the value in the checkbox to display

學(xué)霸

As shown in the picture, which value the v-model is set to equals is the actual label

扔個(gè)三星炸死你

I didn’t see your html, but the value bound to v-model is the same as the value of your option. I can't see the binding value of v-model in your html either.

代言

Changed the demo in the official document
https://jsfiddle.net/athena03...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template