0
0

cascader.html 843 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <style>
  2. </style>
  3. <div id="{$name}">
  4. <input type="hidden" name="{$name}" value="{:implode(',',$val)}">
  5. <el-cascader
  6. v-model="value"
  7. :options="options"
  8. :props="props"
  9. size="medium"
  10. filterable
  11. clearable
  12. style="width:100%"
  13. ></el-cascader>
  14. </div>
  15. <script>
  16. new Vue({
  17. el: '#{$name}',
  18. data: function() {
  19. return {
  20. props:{
  21. value: 'id',
  22. label: 'title',
  23. children: 'child'
  24. },
  25. options: {:json_encode($lists)},
  26. value: {:json_encode($val)}
  27. }
  28. },
  29. watch: {
  30. value: function (newVal, oldVal) {
  31. $('input[name={$name}]').val(newVal.join(','));
  32. }
  33. }
  34. })
  35. </script>