select5.html 812 B

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