element-ui select

1. Combination label

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>

<body>
    <div id="app">
        <el-select v-model="options[0].value" placeholder="请选择">
            <! - <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                <template slot-scope></template>
            </el-option> -->
            <el-option v-for="(item,index) in options" :key="index" :label="`${item.label}-${item.value}`" :value="item.value">
                    <!-- <template slot-scope></template> -->
                </el-option>
        </el-select>
    </div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    new Vue({
        el: '#app',
        data: function () {
            return {
                options: [{
                    value: '1556445455525',
                    label: 'afsdsdsiosiodidsu ' , 
                    NUM: ' option. 1 ' 
                }, { 
                    value: ' 2556445455525 ' , 
                    label: ' bfsdsdsiosiodidsu ' , 
                    NUM: ' Option 2 ' 
                }, { 
                    value: ' 3,556,445,455,525 ' , 
                    label: ' cfsdsdsiosiodidsu ' , 
                    NUM: ' Option 3 ' 
                }], 
                value:''
            }
        }    
    })
</script>

</html>
View Code

 

Guess you like

Origin www.cnblogs.com/justSmile2/p/11318612.html
Recommended