0
0

disabled-select.html 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <div id="{$name}">
  2. <input type="hidden" name="{$name}" v-model="value">
  3. {if $disabled==0}
  4. <el-select clearable filterable v-model="value" placeholder="请选择">
  5. <el-option
  6. v-for="item in options"
  7. :key="item.id"
  8. :label="item.title"
  9. :value="item.id.toString()">
  10. </el-option>
  11. </el-select>
  12. {else}
  13. <el-select clearable filterable disabled v-model="value" placeholder="请选择">
  14. <el-option
  15. v-for="item in options"
  16. :key="item.id"
  17. :label="item.title"
  18. :value="item.id.toString()">
  19. </el-option>
  20. </el-select>
  21. {/if}
  22. </div>
  23. <script>
  24. new Vue({
  25. el: '#{$name}',
  26. data: function() {
  27. return {
  28. options: {:json_encode($lists)},
  29. value:"{$val==0?'':$val}"
  30. }
  31. },
  32. watch: {
  33. value: function (newVal, oldVal) {
  34. $('input[name={$name}').val(newVal);
  35. }
  36. }
  37. })
  38. </script>