LayuiInlineUe.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div class="layui-form-item layui-form-text" :style="cssStyle">
  3. <label :class="{'layui-form-label': true, 'layui-required': layVerify != ''}" style="margin-bottom: 0;">{{ label }}</label>
  4. <div class="layui-input-block">
  5. <ue :config="ueConfig" v-model="content" :readonly="readonly" ref="ue"></ue>
  6. </div>
  7. <input type="hidden" name="">
  8. </div>
  9. </template>
  10. <script>
  11. import ue from '@/components/UeAndImg'
  12. export default {
  13. components:{ue},
  14. data () {
  15. return {
  16. content: this.value || '',
  17. }
  18. },
  19. props: {
  20. label: {
  21. type: String,
  22. default: ''
  23. },
  24. ueConfig: {
  25. type: Object,
  26. default: function() {
  27. return {
  28. initialFrameHeight: 400,
  29. }
  30. }
  31. },
  32. value: {
  33. type: String,
  34. default: ''
  35. },
  36. cssStyle: {
  37. type: Object,
  38. default: function() {
  39. return {
  40. width: '100%'
  41. };
  42. }
  43. },
  44. layVerify: {
  45. type: String,
  46. default: ''
  47. },
  48. readonly: {
  49. type: Boolean,
  50. default: false
  51. }
  52. },
  53. watch: {
  54. value() {
  55. this.content = this.value || '';
  56. },
  57. content() {
  58. this.$emit('input', this.content);
  59. }
  60. },
  61. methods: {
  62. getContent: function() {
  63. return this.$refs.ue.getUEContent();
  64. },
  65. getPlainTxt: function() {
  66. return this.$refs.ue.getPlainTxt();
  67. },
  68. getUe: function () {
  69. return this.$refs.ue;
  70. },
  71. empty: function () {
  72. this.content = ""
  73. }
  74. }
  75. }
  76. </script>