123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <div id="{$name}">
- <input type="hidden" name="{$name}" v-model="value">
- <input type="hidden" name="c_type" v-model="value1">
- <el-select clearable filterable 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 v-if="options1.length >0" clearable filterable v-model="value1" placeholder="选择类型">
- <el-option
- v-for="item in options1"
- :key="item.id"
- :label="item.name"
- :value="item.id.toString()">
- </el-option>
- </el-select>
- </div>
- <script>
- new Vue({
- el: '#{$name}',
- data: function() {
- return {
- options: {:json_encode($lists)},
- value:"{$value==0?'':$value}",
- options1:{:json_encode($options1)},
- value1:"{$value1==0?'':$value1}"
- }
- },
- watch: {
- value: function (newVal, oldVal) {
- var that = this;
- $.post('{:url("getType")}',{id:newVal},function (res) {
- that.options1 = res.data;
- that.value1 = '';
- })
- $('input[name={$name}]').val(newVal);
- }
- }
- })
- </script>
|