@jx3box/jx3box-common-ui 8.0.13 → 8.0.14

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": "@jx3box/jx3box-common-ui",
3
- "version": "8.0.13",
3
+ "version": "8.0.14",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -247,7 +247,7 @@ export default {
247
247
  tab: "avatar",
248
248
 
249
249
  post: "",
250
- post_id: "69014",
250
+ post_id: "14497",
251
251
 
252
252
  author: "",
253
253
  wikiPost: null,
@@ -59,6 +59,11 @@
59
59
  {{ views }}
60
60
  </span>
61
61
 
62
+ <span class="u-word-count u-sub-block" v-if="wordCount" title="累计字数">
63
+ <i class="el-icon-sunny"></i>
64
+ {{ wordCount }}
65
+ </span>
66
+
62
67
  <!-- 编辑 -->
63
68
  <a class="u-edit u-sub-block" :href="edit_link" v-if="canEdit">
64
69
  <i class="u-icon-edit el-icon-edit-outline"></i>
@@ -73,11 +78,14 @@ import { __Root,__clients } from "@jx3box/jx3box-common/data/jx3box.json";
73
78
  import { showDate, showTime } from "@jx3box/jx3box-common/js/moment";
74
79
  import { editLink, authorLink } from "@jx3box/jx3box-common/js/utils.js";
75
80
  import User from "@jx3box/jx3box-common/js/user.js";
81
+ import $ from "jquery";
76
82
  export default {
77
83
  name: "single-header",
78
84
  props: ["post", "stat"],
79
85
  data: function() {
80
- return {};
86
+ return {
87
+ wordCount: 0,
88
+ };
81
89
  },
82
90
  computed: {
83
91
  url: function() {
@@ -124,8 +132,18 @@ export default {
124
132
  showClientLabel: function(val) {
125
133
  return __clients[val];
126
134
  },
135
+ countWords: function (){
136
+ this.$nextTick(() => {
137
+ // 需要去除空格 \n \g
138
+ const text = $('.c-article').text()?.replace(/[\s|\n|\r|\t|\g|\ |\~|\`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\-|\_|\+|\=|\||\\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\,|\。|\?|\:|\;|\‘|\’|\”|\“|\、|\·|\!|\(|\)|\》|\《|\『|\』]/g, '');
139
+
140
+ this.wordCount = text?.length || 0;
141
+ })
142
+ }
143
+ },
144
+ mounted: function() {
145
+ this.countWords();
127
146
  },
128
- mounted: function() {},
129
147
  };
130
148
  </script>
131
149