zydx-plus 1.19.104 → 1.19.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.19.104",
3
+ "version": "1.19.105",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -178,9 +178,13 @@ export default {
178
178
  },
179
179
  emits: ['see','del','complete','update:data','enclosureSuccess'],
180
180
  watch:{
181
- data(e) {
182
- this.editor.commands.setContent(json2html({node: "root",child: (e.html === undefined)? [] : e.html}))
183
- this.uploadAttData = (e.enclosure === undefined)? [] : this.enclosureAction(e.enclosure)
181
+ // 强制监听data变化
182
+ data: {
183
+ handler: function (e, oldVal) {
184
+ this.editor.commands.setContent(json2html({node: "root",child: (e.html === undefined)? [] : e.html}))
185
+ this.uploadAttData = (e.enclosure === undefined)? [] : this.enclosureAction(e.enclosure)
186
+ },
187
+ deep: true
184
188
  }
185
189
  },
186
190
  mounted() {
@@ -387,15 +391,33 @@ export default {
387
391
  line-height: 22px;
388
392
  }
389
393
  .enclosure-list{
390
- display: flex;
391
- justify-content: space-between;
392
- align-items: center;
393
394
  margin: 5px 20px 0 20px;
394
395
  height: 22px;
395
396
  line-height: 22px;
396
397
  }
398
+ .enclosure-list:after{
399
+ content: "";
400
+ clear: left;
401
+ display: block;
402
+ }
403
+ .enclosure-item:first-child{
404
+ width: calc(100% - 210px);
405
+ }
406
+ .enclosure-item:last-child{
407
+ width: 210px;
408
+ }
397
409
  .enclosure-item{
398
- flex: 1;
410
+ height: 22px;
411
+ float: left;
412
+ }
413
+ .enclosure-item>span{
414
+ display: inline-block;
415
+ overflow: hidden;
416
+ text-overflow: ellipsis;
417
+ white-space: nowrap;
418
+ max-width: 100%;
419
+ box-sizing: border-box;
420
+ padding-right: 20px;
399
421
  }
400
422
  .en-but{
401
423
  text-align: right;
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div class="text" :style="{'min-height': height + 'px'}" :contenteditable="true" ref="textarea"></div>
2
+ <div class="textarea">
3
+ <div class="text" :style="{'min-height': height + 'px'}" @input="event => checkLength(event, maxLength)" :contenteditable="true" ref="textarea"></div>
4
+ <span class="num" v-if="maxLength !== 0">{{ num }}/{{ maxLength }}</span>
5
+ </div>
3
6
  </template>
4
7
 
5
8
  <script>
@@ -8,6 +11,11 @@ import Textarea from "@/App.vue";
8
11
  export default {
9
12
  name: "zydx-textarea",
10
13
  components: {Textarea},
14
+ data() {
15
+ return {
16
+ num: 0
17
+ }
18
+ },
11
19
  props: {
12
20
  value: {
13
21
  type: String,
@@ -16,6 +24,10 @@ export default {
16
24
  height: {
17
25
  type: Number,
18
26
  default: 200
27
+ },
28
+ maxLength: {
29
+ type: Number,
30
+ default: 0
19
31
  }
20
32
  },
21
33
  watch: {
@@ -27,6 +39,16 @@ export default {
27
39
  this.$refs.textarea.innerHTML = this.value
28
40
  },
29
41
  methods: {
42
+ checkLength(event, maxLength) {
43
+ if(maxLength === 0) return
44
+ const text = event.target.innerText;
45
+ this.num = text.length
46
+ if (text.length >= maxLength) {
47
+ event.preventDefault();
48
+ event.target.innerText = text.substr(0, maxLength);
49
+ event.target.blur();
50
+ }
51
+ },
30
52
  getContent() {
31
53
  const html = this.$refs.textarea.innerHTML
32
54
  return html.replace(/<div>/g, '<br>').replace(/<\/div>/g, '').replace(/<p>/g, '<br>').replace(/<\/p>/g, '')
@@ -36,10 +58,20 @@ export default {
36
58
  </script>
37
59
 
38
60
  <style scoped>
61
+ .textarea{
62
+ position: relative;
63
+ }
64
+ .num{
65
+ position: absolute;
66
+ bottom: 10px;
67
+ right: 10px;
68
+ z-index: 1;
69
+ }
39
70
  .text{
40
71
  width: 100%;
41
72
  border: 1px solid #ccc;
42
73
  padding: 10px;
43
74
  box-sizing: border-box;
75
+ background-color: #fff;
44
76
  }
45
77
  </style>
package/src/index.js CHANGED
@@ -57,7 +57,7 @@ function install(app) {
57
57
  }
58
58
 
59
59
  export default {
60
- version: '1.19.104',
60
+ version: '1.19.105',
61
61
  install,
62
62
  Calendar,
63
63
  Message,