@jx3box/jx3box-common-ui 5.4.5 → 5.5.0

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.
@@ -1,14 +1,14 @@
1
1
  .c-header-jx3box {
2
2
  background-color: @bg-black;
3
3
  .z(800);
4
- overflow-y:auto;
4
+ overflow-y: auto;
5
5
  .w(100%);
6
- box-shadow: 0 5px 5px rgba(0,0,0,.2);
7
- transition:0.5s ease-in-out;
6
+ box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2);
7
+ transition: 0.5s ease-in-out;
8
8
  .clearfix;
9
9
 
10
10
  .none;
11
- &.on{
11
+ &.on {
12
12
  .db;
13
13
  }
14
14
 
@@ -46,7 +46,7 @@
46
46
  background-color: @bg-light;
47
47
  .pr;
48
48
  overflow: hidden;
49
- .u-pic-hover{
49
+ .u-pic-hover {
50
50
  .none;
51
51
  }
52
52
  }
@@ -61,7 +61,8 @@
61
61
  // }
62
62
  }
63
63
  }
64
- .u-pic,.u-pic-hover {
64
+ .u-pic,
65
+ .u-pic-hover {
65
66
  .size(32px);
66
67
  .db;
67
68
  .auto(x);
@@ -101,21 +102,23 @@
101
102
  }
102
103
 
103
104
  .pr;
104
- .u-close{
105
+ .u-close {
105
106
  // .pa;.rb(0);
106
107
  .fr;
107
- background-color:@color;
108
+ background-color: @color;
108
109
  .fz(13px);
109
- padding:5px 10px;
110
- i{.mr(3px);}
110
+ padding: 5px 10px;
111
+ i {
112
+ .mr(3px);
113
+ }
111
114
  .pointer;
112
115
  }
113
116
  }
114
- .c-header-jx3box.isOverlay{
115
- background-color:rgba(0,0,0,.85);
117
+ .c-header-jx3box.isOverlay {
118
+ background-color: rgba(0, 0, 0, 0.85);
116
119
  }
117
120
  @media screen and (max-width: @ipad) {
118
- .c-jx3box{
121
+ .c-jx3box {
119
122
  .u-app-start {
120
123
  clear: none;
121
124
  }
@@ -123,42 +126,50 @@
123
126
  }
124
127
  }
125
128
 
126
- @media screen and (max-width:@phone){
127
- .c-jx3box{
128
- .u-list{
129
- display: flex;
130
- flex-wrap: wrap;
131
- padding-right:10px;
132
- li{
133
- .w(25%);
134
- .mr(0);
135
- // flex:1;
129
+ @media screen and (max-width: @phone) {
130
+ .c-jx3box {
131
+ .u-list {
132
+ padding-right: 20px;
133
+ // display: flex;
134
+ // flex-wrap: wrap;
135
+ li {
136
+ // flex: 1;
137
+ margin-right: 15px;
138
+ margin-bottom: 15px;
139
+ &:nth-child(4n) {
140
+ .mr(0) !important;
141
+ }
136
142
  }
137
143
  }
138
- .u-item{
139
- .mr(20px);
140
- .u-txt{
144
+ .u-item {
145
+ .size(68px);
146
+ .u-txt {
141
147
  .fz(10px);
142
148
  }
143
- .u-pic{
149
+ .u-pic {
144
150
  .size(28px);
145
151
  }
146
152
  }
147
- li:nth-child(4n) .u-item{
148
- .mr(0) !important;
149
- }
150
153
  }
151
154
  }
152
- @media screen and (max-width:320px){
153
- .c-jx3box{
154
- .u-item{
155
- .size(60px);
156
- .u-txt{
157
- .fz(10px);
155
+ @media screen and (max-width: 320px) {
156
+ .c-jx3box {
157
+ .u-list{
158
+ li{
159
+ .mr(12px);
160
+ .mb(12px);
158
161
  }
159
- .u-pic{
162
+ }
163
+ .u-item {
164
+ .size(60px);
165
+ // .u-txt {
166
+ // .pr;
167
+ // left:-3px;
168
+ // transform: scale(0.8);
169
+ // }
170
+ .u-pic {
160
171
  .size(28px);
161
172
  }
162
173
  }
163
174
  }
164
- }
175
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "5.4.5",
3
+ "version": "5.5.0",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  "@jx3box/jx3box-comment-ui": "^1.6.6",
34
34
  "@jx3box/jx3box-common": "^6.7.8",
35
35
  "@jx3box/jx3box-data": "^1.8.3",
36
- "@jx3box/jx3box-editor": "^1.0.7",
36
+ "@jx3box/jx3box-editor": "^1.1.2",
37
37
  "axios": "^0.19.2",
38
38
  "element-ui": "^2.13.2",
39
39
  "jquery": "^3.5.1",
package/src/App.vue CHANGED
@@ -8,7 +8,6 @@
8
8
 
9
9
  <LeftSidebar :open="true">
10
10
  <LeftSideToggle :mobileOnly="true" />
11
- <div id="directory"></div>
12
11
  <Author :author="author" :uid="8" />
13
12
  </LeftSidebar>
14
13
 
@@ -16,13 +15,13 @@
16
15
  <el-tabs v-model="tab" type="card">
17
16
  <el-tab-pane label="CMS作品" name="post">
18
17
  <el-radio-group v-model="post_id">
19
- <el-radio label="35605">测试Markdown</el-radio>
18
+ <el-radio label="35605">Markdown</el-radio>
20
19
  <el-radio label="32035">仅小册</el-radio>
21
20
  <el-radio label="30017">仅联合创作者</el-radio>
22
21
  <el-radio label="30582">小册和联合创作者</el-radio>
23
22
  <el-radio label="31129">无小册和联合创作者</el-radio>
24
23
  </el-radio-group>
25
- <singlebox :post="post" />
24
+ <singlebox :post="post" @extendUpdate="updateExtend"/>
26
25
  </el-tab-pane>
27
26
  <el-tab-pane label="通用组件" name="widget">
28
27
  <PostHeader :post="post" />
@@ -80,6 +79,7 @@
80
79
 
81
80
  <RightSidebar>
82
81
  <RightSideMsg>Hello</RightSideMsg>
82
+ <div id="directory"></div>
83
83
  <PostCollection :id="59" />
84
84
  </RightSidebar>
85
85
 
@@ -105,6 +105,7 @@ import RightSideMsg from "./RightSideMsg.vue";
105
105
  import Footer from "./Footer.vue";
106
106
  import Bottom from "./Bottom.vue";
107
107
 
108
+ // import cmsList from "./list/cms-list.vue";
108
109
  import singlebox from "./single/cms-single.vue";
109
110
  import PostHeader from "./single/PostHeader.vue";
110
111
  import PostCollection from "./single/PostCollection.vue";
@@ -149,6 +150,7 @@ export default {
149
150
  Bottom,
150
151
  RightSidebar,
151
152
 
153
+ // cmsList,
152
154
  singlebox,
153
155
  PostHeader,
154
156
  PostCollection,
@@ -213,6 +215,9 @@ export default {
213
215
  this.$forceUpdate()
214
216
  });
215
217
  },
218
+ updateExtend : function (val){
219
+ console.log(val)
220
+ }
216
221
  },
217
222
  watch: {
218
223
  post_id: {
package/src/Box.vue CHANGED
@@ -12,11 +12,11 @@
12
12
  <span class="u-txt">首页</span>
13
13
  </a>
14
14
  </li>
15
- <li v-for="(item,i) in data" :key="i" :class="{'u-app-start':item.lf}" v-show="item.status && matchedClient(item.client)">
15
+ <li v-for="(item,i) in list" :key="i" :class="{'u-app-start':item.lf}">
16
16
  <a class="u-item" :href="item.href" :target="item.href | getTarget">
17
- <img class="u-pic" svg-inline :src="item.img | getBoxIcon" />
18
- <img class="u-pic-hover" svg-inline :src="item.hover | getBoxIcon" />
19
- <span class="u-txt">{{item.name}}</span>
17
+ <img class="u-pic" :src="item.img | getBoxIcon" />
18
+ <!-- <img class="u-pic-hover" svg-inline :src="item.hover | getBoxIcon" /> -->
19
+ <span class="u-txt">{{item.abbr}}</span>
20
20
  </a>
21
21
  </li>
22
22
  </ul>
@@ -55,6 +55,11 @@ export default {
55
55
  originicon: function () {
56
56
  return __imgPath + "image/box/origin.svg";
57
57
  },
58
+ list : function (){
59
+ return this.data.filter((item,i) => {
60
+ return item.status && (item.client == this.client || item.client == 'all')
61
+ })
62
+ }
58
63
  },
59
64
  methods: {
60
65
  closeBox: function () {
@@ -95,7 +100,7 @@ export default {
95
100
  return __imgPath + "image/box/" + val;
96
101
  },
97
102
  getTarget: function (val) {
98
- if (window.innerWidth < 768 || val.startsWith("/")) {
103
+ if (window.innerWidth < 768 || val?.startsWith("/")) {
99
104
  return "_self";
100
105
  } else {
101
106
  return "_blank";
@@ -15,8 +15,8 @@
15
15
  ></a>
16
16
  <el-dropdown-menu slot="dropdown" class="c-header-menu">
17
17
  <el-dropdown-item
18
- v-for="subitem in item.children"
19
- :key="'header-nav-drop-' + subitem.key"
18
+ v-for="(subitem, subIndex) in item.children"
19
+ :key="'header-nav-drop-' + subitem.key + subIndex"
20
20
  class="u-menu-item"
21
21
  >
22
22
  <a
@@ -69,6 +69,7 @@ export default {
69
69
  loadData: function() {
70
70
  getCollection(this.id).then((res) => {
71
71
  this.data = res.data?.data?.collection;
72
+ this.$emit('collectionUpdate',this.data)
72
73
  });
73
74
  },
74
75
  },
@@ -31,7 +31,7 @@ export default {
31
31
  },
32
32
  computed: {
33
33
  list: function() {
34
- return this.data?.posts || this.store?.posts;
34
+ return this.store?.posts || this.data?.posts;
35
35
  },
36
36
  },
37
37
  watch: {
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <div class="m-single-directory"></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ name : 'PostDirectory',
8
+ props:[],
9
+ components : {},
10
+ data : function(){
11
+ return {
12
+
13
+ }
14
+ },
15
+ computed:{},
16
+ watch:{},
17
+ methods:{},
18
+ filters:{},
19
+ created:function(){},
20
+ mounted:function(){},
21
+ }
22
+ </script>
23
+
24
+ <style lang="less">
25
+ .c-article-directory {
26
+ h1,
27
+ h2,
28
+ h3,
29
+ h4,
30
+ h5,
31
+ h6 {
32
+ margin: 0;
33
+ padding: 0;
34
+ cursor: pointer;
35
+ font-weight: normal;
36
+ white-space: nowrap;
37
+ word-wrap: normal;
38
+ word-break: keep-all;
39
+ text-overflow: ellipsis;
40
+ overflow: hidden;
41
+ letter-spacing: 0.2px;
42
+ line-height: 20px;
43
+ padding: 8px 0;
44
+ &:hover {
45
+ // font-weight: 600;
46
+ color: #0366d6;
47
+ }
48
+ font-size: 12px;
49
+ }
50
+ a {
51
+ color: @color;
52
+ }
53
+
54
+ h1,
55
+ h2,
56
+ h3,
57
+ h4,
58
+ h5,
59
+ h6 {
60
+ &::before {
61
+ content: "\e78b";
62
+
63
+ font-family: element-icons !important;
64
+ speak: none;
65
+ font-style: normal;
66
+ font-weight: 400;
67
+ font-variant: normal;
68
+ text-transform: none;
69
+ line-height: 1;
70
+ vertical-align: baseline;
71
+ display: inline-block;
72
+ -webkit-font-smoothing: antialiased;
73
+ margin-right: 5px;
74
+ font-size: 16px;
75
+ }
76
+ }
77
+
78
+ // .hasChild {
79
+ // font-size: 14px;
80
+ // &::before {
81
+ // content: "\e784";
82
+ // }
83
+ // }
84
+
85
+ // h2,h3,h4,h5,h6{
86
+ // margin-left: 20px;
87
+ // }
88
+ // .hasChild{
89
+ // margin-left: 0;
90
+ // }
91
+
92
+ // h3 + h2,h4 + h3,h5 + h4,h6 + h5{
93
+ // margin-left: 0;
94
+ // }
95
+
96
+ .lv2 {
97
+ padding-left: 20px;
98
+ }
99
+
100
+ .lv3 {
101
+ padding-left: 40px;
102
+ }
103
+
104
+ .lv0 {
105
+ display: none;
106
+ }
107
+ }
108
+
109
+ .c-article-directory-title {
110
+ margin-bottom: 5px;
111
+ .c-article-directory-title-label {
112
+ font-weight: 300;
113
+ font-size: 20px;
114
+ // cursor: pointer;
115
+ // &:hover {
116
+ // color: #f39;
117
+ // }
118
+ }
119
+ .c-article-directory-title-skip,
120
+ .c-article-directory-title-folder {
121
+ font-size: 14px;
122
+ float: right;
123
+ padding: 0 5px;
124
+ line-height: 25px;
125
+ color: darken(#dcdfe6, 5%);
126
+ cursor: pointer;
127
+ &:hover {
128
+ color: darken(#dcdfe6, 20%);
129
+ }
130
+ }
131
+ }
132
+ .c-article-directory-content {
133
+ padding: 10px 15px;
134
+ }
135
+
136
+ @keyframes focusFade {
137
+ from {
138
+ background-color: #c3fcff;
139
+ }
140
+ to {
141
+ background-color: transparent;
142
+ }
143
+ }
144
+
145
+ .c-article .isScrollFocus {
146
+ animation: focusFade 0.5s ease-in-out;
147
+ }
148
+ </style>
@@ -10,7 +10,7 @@
10
10
  <!-- 联合创作者 -->
11
11
  <Creators class="m-single-creators" :postId="id" :postType="post_type" />
12
12
  <!-- 文集小册 -->
13
- <Collection class="m-single-collection" :id="collection_id" :defaultVisible="collection_collapse" />
13
+ <Collection class="m-single-collection" :id="collection_id" :defaultVisible="collection_collapse" @collectionUpdate="updateCollection"/>
14
14
  <slot name="single-prepend"></slot>
15
15
  </div>
16
16
 
@@ -19,8 +19,8 @@
19
19
  <el-divider content-position="left">JX3BOX</el-divider>
20
20
  <div class="m-single-content">
21
21
  <slot></slot>
22
- <ArticleMarkdown v-if="isMarkdown" :content="post_content" />
23
- <Article v-else :content="post_content" />
22
+ <ArticleMarkdown v-if="isMarkdown" :content="post_content" @directoryRendered="updateDirectory"/>
23
+ <Article v-else :content="post_content" @directoryRendered="updateDirectory"/>
24
24
  </div>
25
25
  </div>
26
26
  <div class="m-single-null" v-else>
@@ -73,6 +73,8 @@ export default {
73
73
  props: ["post", "stat"],
74
74
  data: function() {
75
75
  return {
76
+ collection_data : '',
77
+ directory : false
76
78
  };
77
79
  },
78
80
  computed: {
@@ -111,8 +113,31 @@ export default {
111
113
  },
112
114
  allow_comment : function (){
113
115
  return !this.post?.comment
116
+ },
117
+ extend_data : function (){
118
+ return {
119
+ collection_data : this.collection_data,
120
+ directory : this.directory
121
+ }
114
122
  }
115
123
  },
124
+ methods : {
125
+ updateCollection : function (val){
126
+ this.collection_data = val
127
+ },
128
+ updateDirectory : function (val){
129
+ this.directory = val
130
+ }
131
+ },
132
+ watch : {
133
+ extend_data : {
134
+ deep : true,
135
+ immediate : true,
136
+ handler : function (val){
137
+ this.$emit('extendUpdate',val)
138
+ }
139
+ }
140
+ }
116
141
  };
117
142
  </script>
118
143
 
@@ -1,354 +0,0 @@
1
- // 列表搜索
2
- .m-archive-search{
3
- .mb(10px);
4
- .el-select .el-input {
5
- width: 80px;
6
- }
7
- .u-switch{
8
- .el-switch__label{
9
- .bold;
10
- color:#666;
11
- }
12
- }
13
- .pl(122px);
14
- .pr;
15
- .u-publish{
16
- .pa;.lt(0);
17
- }
18
- }
19
- @media screen and (max-width:@phone){
20
- .m-archive-search{
21
- .pl(0);
22
- .u-publish{
23
- .none;
24
- }
25
- }
26
- }
27
- // 排序
28
- .m-archive-filter {
29
- .fz(12px);
30
- margin-bottom: 10px;
31
- padding-bottom: 5px;
32
- .clearfix;
33
- border-bottom: 1px solid #eee;
34
- .u-publish {
35
- .fl;
36
- .h(32px);
37
- .mr(10px);
38
- .ml(0);
39
- }
40
- .w-filter-mark,.w-filter-tag,.w-filter-client{
41
- .fl;
42
- }
43
- .w-filter-client{
44
- margin-top:(32px - 28px )/2;
45
- .mr(10px);
46
- }
47
- .w-filter-mark,.w-filter-tag{
48
- margin-top:8px;
49
- }
50
- .w-filter-menu{
51
- .fl;
52
- .mt(6px);
53
- .mr(15px);
54
- }
55
-
56
- .w-filter-order{
57
- .fr;
58
- margin-top:8px;
59
- }
60
- }
61
- @media screen and (max-width: @ipad) {
62
- .m-archive-filter {
63
- .u-publish {
64
- .mr(10px);
65
- }
66
- .w-filter-mark,.w-filter-tag,.w-filter-order{
67
- margin-top:0;
68
- }
69
- .w-filter-mark,.w-filter-tag{
70
- .mr(10px);
71
- }
72
- }
73
- }
74
- @media screen and (max-width: @phone) {
75
- .m-archive-filter {
76
- .none;
77
- }
78
- }
79
- // 为空
80
- .m-archive-null {
81
- margin-top: 10px;
82
- }
83
-
84
- // 加载更多
85
- .m-archive-more {
86
- .mb(10px);
87
- .w(100%);
88
- .none;
89
- }
90
- .m-archive-more.show {
91
- .db;
92
- }
93
-
94
- // 分页
95
- .m-archive-pages {
96
- overflow-x: auto;
97
- }
98
- @media screen and (max-width:@phone){
99
- .m-archive-pages{
100
- .el-pagination__jump{
101
- .none !important;
102
- }
103
- }
104
- }
105
-
106
- // 普通列表
107
- .m-archive-list {
108
- .u-list {
109
- padding: 0;
110
- margin: 0;
111
- list-style: none;
112
- }
113
-
114
- .u-item {
115
- border-bottom: 1px solid @border-hr;
116
- padding-bottom: 20px;
117
- .mb(20px);
118
- .clearfix;
119
- .pr;
120
- }
121
-
122
- // 海报
123
- .u-banner {
124
- .fl;
125
- .mr(10px);
126
- .w(180px);
127
- .h(100px);
128
- overflow: hidden;
129
- .db;
130
- .pr;
131
- .z(1);
132
- border: 1px solid #eee;
133
- padding: 5px;
134
- box-sizing: border-box;
135
- img {
136
- .size(100%);
137
- filter: saturate(120%);
138
- transition: 0.06s all ease-in-out;
139
- }
140
- transition: 0.06s border ease-in-out;
141
- &:hover {
142
- img {
143
- filter: saturate(140%) brightness(120%);
144
- }
145
- border-color: @border;
146
- }
147
- }
148
-
149
- // 标题
150
- .u-post {
151
- margin: 0;
152
- padding: 0;
153
- .nobreak;
154
- .mb(5px);
155
- .u-icon {
156
- .size(16px);
157
- .y(-3px);
158
- .mr(5px);
159
- }
160
- &.isSticky {
161
- .u-title::before {
162
- content: "🎯";
163
- .mr(5px);
164
- }
165
- // .u-title:hover{
166
- // box-shadow: 0 1px 0 #f00;
167
- // }
168
- }
169
- .u-title {
170
- // color:@darkblue;
171
- font-weight:400;
172
- &:hover {
173
- box-shadow: 0 1px 0 @primary;
174
- }
175
- }
176
- .fz(15px, 2);
177
- font-weight: normal;
178
- .lh(2);
179
- font-weight: 400;
180
- }
181
-
182
- // 角标
183
- .u-marks {
184
- }
185
- .u-mark {
186
- font-style: normal;
187
- font-size: 12px;
188
- padding: 1px 5px 2px 5px;
189
- margin-left: 5px;
190
- border-radius: 2px;
191
- background-color: #6f42c1;
192
- color: #fff;
193
- .ml(5px);
194
- }
195
-
196
- // 内容
197
- .u-content {
198
- .db;
199
- padding-left: 20px;
200
- .pr;
201
- }
202
-
203
- // 内容·描述类
204
- .u-desc {
205
- .db;
206
- .fz(12px, 1.8);
207
- color: #555;
208
- .break(2);
209
- .mb(6px);
210
- padding: 0 2px;
211
- }
212
-
213
- // 内容·meta列表
214
- .u-metalist {
215
- .nobreak;
216
- .db;
217
- .fz(12px, 25px);
218
- .mb(4px);
219
- strong {
220
- .dbi;
221
- .y(top);
222
- padding: 0 10px;
223
- .mr(10px);
224
- .r(4px);
225
- background-color: #f1f8ff;
226
- color: @color-link;
227
- font-weight: normal;
228
- }
229
- em {
230
- font-style: normal;
231
- }
232
- b {
233
- font-weight: normal;
234
- }
235
- a {
236
- color: #333;
237
- &:hover {
238
- color: @color-link;
239
- box-shadow: 0 1px 0 @color-link;
240
- }
241
- }
242
- }
243
- .u-tag {
244
- .db;
245
- .nobreak;
246
- a,
247
- b {
248
- padding: 0.2em 0.8em;
249
- margin: 0 0.5em 0 0;
250
- background-color: #f1f8ff;
251
- border-radius: 3px;
252
- .fz(12px);
253
- color: #4989d2;
254
- }
255
- a:hover {
256
- background-color: #def;
257
- }
258
- }
259
- .u-types {
260
- .db;
261
- .nobreak;
262
- b {
263
- padding: 0.1em 0.8em;
264
- margin: 0 0.5em 0.5em 0;
265
- border-radius: 3px;
266
- .fz(12px);
267
- .dbi;
268
- .y(top);
269
- }
270
- }
271
-
272
- // 底部
273
- .u-misc {
274
- .db;
275
- .pa;
276
- .rb(10px, 24px);
277
- .x(right);
278
- .fz(12px, 20px);
279
- color: #777;
280
- }
281
-
282
- .u-author{
283
- // .pa;.rt(0);
284
- }
285
- .u-author-avatar {
286
- .size(24px);
287
- .y;
288
- .r(2px);
289
- .mr(5px);
290
- // .fr;
291
- // .ml(5px);
292
- }
293
- .u-author-name {
294
- .fz(12px,24px);
295
- // .fl;
296
- color:#666;
297
- &:hover {
298
- color:@pink;
299
- }
300
- }
301
- .u-date {
302
- .db;
303
- .mt(3px);
304
- .clear;
305
- }
306
-
307
- .u-down {
308
- // .u-btn-white;
309
- i {
310
- .size(12px);
311
- .y(-1px);
312
- }
313
- }
314
- .u-pipe {
315
- margin: 0 5px;
316
- color: #999;
317
- }
318
- }
319
- @media screen and (max-width: @ipad) {
320
- .m-archive-list {
321
- .u-banner {
322
- .w(100px);
323
- .h(55px);
324
- padding: 3px;
325
- .fr;
326
- margin-left: 10px;
327
- margin-right: 0;
328
- }
329
-
330
- .u-post {
331
- white-space: normal;
332
- word-break: break-all;
333
- .break(2);
334
- .fz(14px, 22px);
335
- }
336
-
337
- .u-metalist,
338
- .u-down,
339
- .u-view {
340
- .none;
341
- }
342
- .u-tag {
343
- .mb(8px);
344
- }
345
-
346
- .u-misc {
347
- .ps;
348
- .x(left);
349
- }
350
- .u-author-name {
351
- color: #555;
352
- }
353
- }
354
- }
@@ -1,77 +0,0 @@
1
- <template>
2
- <div class="m-archive-box">
3
- <!-- 搜索靠前 -->
4
- <slot name="search-before"></slot>
5
- <!-- 筛选 -->
6
- <div class="m-archive-filter" v-if="$slots.filter">
7
- <slot name="filter"></slot>
8
- </div>
9
- <!-- 搜索靠后 -->
10
- <slot name="search-after"></slot>
11
- <!-- 列表 -->
12
- <slot></slot>
13
- <!-- 空 -->
14
- <el-alert v-if="!list.length" class="m-archive-null" title="没有找到相关条目" type="info" center show-icon></el-alert>
15
- <!-- 下一页 -->
16
- <el-button class="m-archive-more" :class="{ show: hasNextPage }" type="primary" @click="appendPage">加载更多</el-button>
17
- <!-- 分页 -->
18
- <el-pagination
19
- class="m-archive-pages"
20
- background
21
- layout="total, prev, pager, next,jumper"
22
- :hide-on-single-page="true"
23
- :page-size="perPage"
24
- :total="totalRecords"
25
- :current-page.sync="currentPage"
26
- @current-change="changePage"
27
- ></el-pagination>
28
- </div>
29
- </template>
30
- <script>
31
- export default {
32
- name: "cms-list",
33
- props: ["data", "total", "per", "pages", "page"],
34
- data: function() {
35
- return {
36
- currentPage: this.page || 1,
37
- };
38
- },
39
- computed: {
40
- list: function() {
41
- return this.data;
42
- },
43
- totalRecords: function() {
44
- return this.total;
45
- },
46
- totalPages: function() {
47
- return this.pages;
48
- },
49
- perPage: function() {
50
- return this.per;
51
- },
52
- hasNextPage: function() {
53
- return this.totalRecords > 1 && this.currentPage < this.totalPages;
54
- },
55
- },
56
- methods: {
57
- appendPage: function() {
58
- this.$emit("appendPage", ++this.currentPage);
59
- },
60
- changePage: function(i) {
61
- this.$emit("changePage", i);
62
- this.$route.query.page = i;
63
- },
64
- },
65
- watch: {
66
- page: function(page) {
67
- this.currentPage = page;
68
- },
69
- },
70
- mounted: function() {},
71
- components: {},
72
- };
73
- </script>
74
-
75
- <style lang="less">
76
- @import "../../assets/css/cms-list.less";
77
- </style>