input.html 1018 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <style>
  2. </style>
  3. <div id="{$name}">
  4. <input type="hidden" name="{$name}" :value="value">
  5. <el-input
  6. size="small"
  7. placeholder="请输入"
  8. v-model="value"
  9. style="width:100%"
  10. type="<?php if(isset($type)){echo $type;}else{echo 'text';};?>"
  11. minlength="<?php if(isset($minlength)){echo $minlength;}else{echo 0;};?>"
  12. maxlength="<?php if(isset($maxlength)){echo $maxlength;}else{echo 200;};?>"
  13. clearable
  14. :disabled="<?php if(isset($disabled)){echo $disabled;}else{echo 'false';};?>"
  15. :readonly="<?php if(isset($readonly)){echo $readonly;}else{echo 'false';};?>"
  16. show-word-limit
  17. />
  18. </div>
  19. <script>
  20. new Vue({
  21. el: '#{$name}',
  22. data: function() {
  23. return {
  24. value: '{$val}'
  25. }
  26. },
  27. watch: {
  28. value: function (newVal, oldVal) {
  29. $('input[name={$name}]').val(newVal);
  30. }
  31. },
  32. created(){
  33. }
  34. })
  35. </script>