12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <style>
- </style>
- <div id="{$name}">
- <input type="hidden" id="ele-{$name}" name="{$name}" :value="value.join(',')">
- <el-select
- v-model="value"
- multiple
- collapse-tags
- filterable
- size="small"
- style="width:100%"
- placeholder="请选择"
- >
- <el-option
- v-for="item in options"
- :key="item.id"
- :label="item.title"
- :value="item.id.toString()">
- </el-option>
- </el-select>
- </div>
- <script>
- new Vue({
- el: '#{$name}',
- data: function() {
- return {
- options: {:json_encode($lists)},
- value: {:json_encode($val)}
- }
- },
- watch: {
- value: function (newVal, oldVal) {
- $('#ele-{$name}').val(newVal.join(','));
- }
- },
- created(){
- const vals = this.value;
- this.value = [];
- vals.forEach((item) => {
- this.value.push(item.toString());
- })
- console.log('11111',this.value,this.options);
- }
- })
- </script>
|