12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <div id="{$name}">
- <input type="hidden" name="{$name}" v-model="value.join(',')">
- <input type="hidden" name="{$name1}" v-model="value1.join(',')">
- <el-select clearable filterable multiple v-model="value" placeholder="请选择分类">
- <el-option
- v-for="item in options"
- :key="item.id"
- :label="item.title"
- :value="item.id.toString()">
- </el-option>
- </el-select>
- </br>
- </br>
- <el-select
- clearable filterable
- v-model="value1"
- multiple
- collapse-tags
- placeholder="选择{$title}">
- <el-option
- v-for="item in options1"
- :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($value)},
- options1:{:json_encode($options1)},
- value1:{:json_encode($value1)},
- }
- },
- watch: {
- value: function (newVal, oldVal) {
- var that = this;
- $.post('{$url}',{id:newVal},function (res) {
- that.options1 = res.data;
- that.value1 = [];
- })
- $('input[name={$name}]').val(newVal.join(','));
- },
- value1: function (newVal, oldVal) {
- $('input[name={$name}]').val(newVal.join(','));
- }
- }
- })
- </script>
|