0
0

timepicker.html 724 B

1234567891011121314151617181920212223242526272829303132333435
  1. <style>
  2. </style>
  3. <div id="{$name}">
  4. <input type="hidden" name="{$name}" :value="value">
  5. <el-time-picker
  6. v-model="value"
  7. size="small"
  8. placeholder="选择时间"
  9. value-format="HH:mm"
  10. style="width:100%"
  11. >
  12. </el-time-picker>
  13. </div>
  14. <script>
  15. new Vue({
  16. el: '#{$name}',
  17. data: function() {
  18. return {
  19. value: ''
  20. }
  21. },
  22. watch: {
  23. value: function (newVal, oldVal) {
  24. $('input[name={$name}]').val(newVal);
  25. }
  26. },
  27. created(){
  28. const vals = '{$val}';
  29. if(vals){
  30. this.value = vals;
  31. }
  32. }
  33. })
  34. </script>