xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

element-ui select get selected option object

element-ui select get selected option object

value-key="value" === String ✅

:value="{value, label, token, trueValue, packageId}" === Object ✅

v-model="value" === Object ✅

<template>
    <div class="token-select-box">
        <el-select
            popper-class="token-select-option-box"
            v-model="value"
            @change="selectHandler"
            :filterable="searchable"
            :clearable="clearable"
            value-key="value"
            :placeholder="placeholder">
            <el-option
                class="token-select-option"
                v-for="({
                    value,
                    label,
                    token,
                    trueValue,
                    packageId,
                }, index) in options"
                :key="index"
                :label="label"
                :value="{value, label, token, trueValue, packageId}">
                <span class="left">{{label}}</span>
                <span v-if="token !== undefined" class="right">{{token}}</span>
            </el-option>
        </el-select>
        <!-- <el-select
            popper-class="token-select-option-box"
            v-model="value"
            @change="selectHandler"
            :filterable="searchable"
            :clearable="clearable"
            :placeholder="placeholder">
            <el-option
                class="token-select-option"
                v-for="({
                    value,
                    label,
                    token,
                }, index) in options"
                :key="index"
                :label="label"
                :value="value">
                <span class="left">{{label}}</span>
                <span v-if="token !== undefined" class="right">{{token}}</span>
            </el-option>
        </el-select> -->
    </div>
</template>

https://element.eleme.io/#/zh-CN/component/select

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-02-02 13:24  xgqfrms  阅读(148)  评论(1编辑  收藏  举报