commit | author | age
|
7ee3f4
|
1 |
# 小程序公共组件文档 |
Z |
2 |
|
|
3 |
**注意:调用任何组件需要在外部套一个标签<view></view>,避免意料之外的样式产生。** |
|
4 |
|
|
5 |
## app-radio |
|
6 |
|
|
7 |
- 代码 |
|
8 |
|
|
9 |
````html |
|
10 |
<app-radio></app-radio> |
|
11 |
```` |
|
12 |
- 属性 |
|
13 |
|
|
14 |
- v-model: 开启关闭数据(boolean) |
|
15 |
|
|
16 |
````html |
|
17 |
<app-radio v-model="isShow"></app-radio> |
|
18 |
```` |
|
19 |
|
|
20 |
- theme: 主题色(字符串,变量)--- 变量需在props中定义 |
|
21 |
````html |
|
22 |
<app-radio :theme="theme"></app-radio> |
|
23 |
```` |
|
24 |
|
|
25 |
- type: 类型(String)圆形---round, 默认情况方形 |
|
26 |
|
|
27 |
````html |
|
28 |
<app-radio type="round"></app-radio> |
|
29 |
<app-radio></app-radio> |
|
30 |
```` |
|
31 |
|
|
32 |
## app-input |
|
33 |
|
|
34 |
- 代码 |
|
35 |
|
|
36 |
````html |
|
37 |
<app-input ></app-input> |
|
38 |
```` |
|
39 |
|
|
40 |
- 属性 |
|
41 |
|
|
42 |
- type: 键盘类型(String) |
|
43 |
|
|
44 |
````html |
|
45 |
文本输入键盘 |
|
46 |
<app-input type="text"></app-input> |
|
47 |
数字输入键盘 |
|
48 |
<app-input type="number"></app-input> |
|
49 |
身份证输入键盘 |
|
50 |
<app-input type="idcard"></app-input> |
|
51 |
带小数点的数字键盘 |
|
52 |
<app-input type="digit"></app-input> |
|
53 |
输入框 |
|
54 |
<app-input type="textarea"></app-input> |
|
55 |
```` |
|
56 |
|
|
57 |
- disabled :禁用(Boolean) |
|
58 |
|
|
59 |
````html |
|
60 |
<app-input disabled></app-input> |
|
61 |
```` |
|
62 |
|
|
63 |
- password: 密码(Boolean) |
|
64 |
|
|
65 |
````html |
|
66 |
<app-input password></app-input> |
|
67 |
```` |
|
68 |
|
|
69 |
- placeholder: 占位符(String) |
|
70 |
|
|
71 |
````html |
|
72 |
<app-input placeholder="请输入字符"></app-input> |
|
73 |
```` |
|
74 |
|
|
75 |
- autoHeight: 自动高度(Boolean) type = 'textarea' |
|
76 |
|
|
77 |
````html |
|
78 |
<app-input autoHeight></app-input> |
|
79 |
```` |
|
80 |
|
|
81 |
- showConfirmBar: 显示完成按钮(Boolean) type = 'textarea' |
|
82 |
|
|
83 |
````html |
|
84 |
<app-input showConfirmBar></app-input> |
|
85 |
```` |
|
86 |
|
|
87 |
- placeholderStyle: 占位符文字样式(String) 指定 placeholder 的样式,目前仅支持color,font-size和font-weight type = 'textarea' |
|
88 |
|
|
89 |
````html |
|
90 |
<app-input placeholderStyle="color:red;"></app-input> |
|
91 |
```` |
|
92 |
|
|
93 |
|
|
94 |
## app-form-id |
|
95 |
|
|
96 |
- 代码 |
|
97 |
|
|
98 |
```html |
|
99 |
<view> |
|
100 |
<app-form-id @click="自定义事件触发> |
|
101 |
<app-button>按钮</app-button> |
|
102 |
</app-form-id> |
|
103 |
</view> |
|
104 |
``` |
|
105 |
|
|
106 |
- 在外部嵌套一个标签,内部通过click时间,触发自定义事件,抛出获取到的formid,formid已经保存到缓存中,组件无样式 |
|
107 |
自定义样式 |
|
108 |
|
|
109 |
## app-button |
|
110 |
|
|
111 |
- 代码 |
|
112 |
|
|
113 |
````html |
|
114 |
<app-button>按钮</app-button> |
|
115 |
```` |
|
116 |
|
|
117 |
- 回调 |
|
118 |
|
|
119 |
````html |
|
120 |
<app-button @click="自定义方法">按钮</app-button> |
|
121 |
```` |
|
122 |
|
|
123 |
- 属性 |
|
124 |
|
|
125 |
- disabled: 禁止点击(boolean) |
|
126 |
|
|
127 |
```html |
|
128 |
<app-button disabled>按钮</app-button> |
|
129 |
<app-button :disabled="disabled">按钮</app-button> |
|
130 |
``` |
|
131 |
|
|
132 |
- type: 按钮类型,(字符串)分为三种: 重要-important,一般-general,普通-(不传参) |
|
133 |
|
|
134 |
```html |
|
135 |
<app-button type="important">按钮</app-button> |
|
136 |
``` |
|
137 |
|
|
138 |
- round:圆角按钮,50rpx(boolean)(统一) |
|
139 |
|
|
140 |
```html |
|
141 |
<app-button round>按钮</app-button> |
|
142 |
``` |
|
143 |
|
|
144 |
- theme: 主题色,(字符串,变量)--- 变量需在props中定义 |
|
145 |
|
|
146 |
```html |
|
147 |
<app-button :theme="theme">按钮</app-button> |
|
148 |
``` |
|
149 |
|
|
150 |
- height:高度,(字符串)--- 单位为rpx,不需要传 |
|
151 |
|
|
152 |
```html |
|
153 |
<app-button height="100">按钮</app-button> |
|
154 |
``` |
|
155 |
|
|
156 |
- fontSize: 字体大小,不传,默认为32rpx(字符串)--- 单位为rpx,不需要传 |
|
157 |
|
|
158 |
```html |
|
159 |
<app-button fontSize="10">按钮</app-button> |
|
160 |
``` |
|
161 |
|
|
162 |
- width: 宽度,不传默认为100%,(字符串)--- 单位为rpx.不需要传 |
|
163 |
|
|
164 |
```html |
|
165 |
<app-button width="10">按钮</app-button> |
|
166 |
``` |
|
167 |
|
|
168 |
- color:文字颜色(字符串) |
|
169 |
|
|
170 |
```html |
|
171 |
<app-button color="#000000">按钮</app-button> |
|
172 |
``` |
|
173 |
|
|
174 |
- size: 规定的三种按钮高度,(字符串)分为三种:大---large(100),小---small(60),中---medium(80) |
|
175 |
|
|
176 |
```html |
|
177 |
<app-button size="large">按钮</app-button> |
|
178 |
``` |
|
179 |
|
|
180 |
- background: 背景颜色,不用主题色的情况下使用 |
|
181 |
|
|
182 |
```html |
|
183 |
<app-button background="red">按钮</app-button> |
|
184 |
<app-button background="#ffffff">按钮</app-button> |
|
185 |
``` |
|
186 |
|
|
187 |
## app-form-id app-button |
|
188 |
|
|
189 |
- 两者结合使用 |
|
190 |
|
|
191 |
````html |
|
192 |
<app-form-id @click="自定义方法"> |
|
193 |
<app-button >按钮</app-button> |
|
194 |
</app-form-id> |
|
195 |
```` |
|
196 |
|
|
197 |
## app-jump-button |
|
198 |
|
|
199 |
- 代码 |
|
200 |
|
|
201 |
````html |
|
202 |
<view> |
|
203 |
<app-jump-button></app-jump-button> |
|
204 |
</view> |
|
205 |
```` |
|
206 |
|
|
207 |
- 属性 |
|
208 |
|
|
209 |
- arrangement: 插槽内部排列方式(字符串) column --- 竖排居中对齐,row --- 横排居中对齐 |
|
210 |
|
|
211 |
````html |
|
212 |
<view> |
|
213 |
<app-jump-button arrangement="column"></app-jump-button> |
|
214 |
</view> |
|
215 |
```` |
|
216 |
|
|
217 |
- backgroundColor: 背景颜色 |
|
218 |
|
|
219 |
````html |
|
220 |
<view> |
|
221 |
<app-jump-button backgroundColor="red"></app-jump-button> |
|
222 |
</view> |
|
223 |
<view> |
|
224 |
<app-jump-button backgroundColor="#ffffff"></app-jump-button> |
|
225 |
</view> |
|
226 |
```` |
|
227 |
|
|
228 |
- item: 对象 |
|
229 |
|
|
230 |
``` |
|
231 |
{ |
|
232 |
open_type: "contact", //(redirect, contact, navigate, tel, web, app...) |
|
233 |
url: "pages/index/index", //(跳转路径, 可有可无, 与link_url二选一) |
|
234 |
link_url: "pages/index/index"//(跳转路径, 可有可无, 与link_url二选一) |
|
235 |
} |
|
236 |
|
|
237 |
//redirect: 重定向, |
|
238 |
|
|
239 |
//contact: 客服消息回调, |
|
240 |
|
|
241 |
//navigate: 跳转, |
|
242 |
|
|
243 |
//tel: 电话, |
|
244 |
|
|
245 |
//web: 网页, |
|
246 |
|
|
247 |
//app: 跳转其他小程序 |
|
248 |
``` |
|
249 |
|
|
250 |
## app-report-error |
|
251 |
|
|
252 |
- 代码 |
|
253 |
|
|
254 |
```javascript |
|
255 |
// 服务端报错弹框, 在全局app-layout中使用 |
|
256 |
|
|
257 |
//开启: |
|
258 |
this.$store.dispatch('gConfig/reportAndErrorB', true); |
|
259 |
//关闭: |
|
260 |
this.$store.dispatch('gConfig/reportAndErrorB', false); |
|
261 |
|
|
262 |
//传递报错信息 |
|
263 |
//开启: |
|
264 |
this.$store.dispatch('gConfig/reportAndErrorObj', { |
|
265 |
boolean: true, |
|
266 |
content: '网络开了会儿小差, 请刷新重试下哦~'}); |
|
267 |
|
|
268 |
//关闭: |
|
269 |
this.$store.dispatch('gConfig/reportAndErrorObj', { |
|
270 |
boolean: false, |
|
271 |
content: '网络开了会儿小差, 请刷新重试下哦~'}); |
|
272 |
``` |
|
273 |
|
|
274 |
## app-tab-bar |
|
275 |
|
|
276 |
- 代码 |
|
277 |
|
|
278 |
```javascript |
|
279 |
// 底部导航,放在全局app-layout 中, 再次展现页面时,判断当前页面是否有tabbar |
|
280 |
// 在每一个可能存在tabbar的页面中 写上 |
|
281 |
|
|
282 |
import { mapGetters } from "vuex"; |
|
283 |
export default { |
|
284 |
computed: { |
|
285 |
...mapGetters('mallConfig',{ |
|
286 |
tabBarNavs: 'getNavBar', |
|
287 |
}) |
|
288 |
}, |
|
289 |
onShow() { |
|
290 |
this.$store.dispatch('gConfig/setTabBarBoolean', this.tabBarNavs.navs); |
|
291 |
} |
|
292 |
} |
|
293 |
``` |
|
294 |
|
|
295 |
## app-loading |
|
296 |
|
|
297 |
- 代码 |
|
298 |
|
|
299 |
```html |
|
300 |
<app-loading></app-loading> |
|
301 |
``` |
|
302 |
|
|
303 |
- 属性 |
|
304 |
|
|
305 |
- type: loading 类型(字符串) 全局---global,小框--- toast |
|
306 |
|
|
307 |
```html |
|
308 |
<app-loading type="toast"></app-loading> |
|
309 |
<app-loading type="global"></app-loading> |
|
310 |
``` |
|
311 |
|
|
312 |
- text: 显示文字 (字符串) |
|
313 |
|
|
314 |
```html |
|
315 |
<app-loading text="加载中..."></app-loading> |
|
316 |
``` |
|
317 |
|
|
318 |
- backgroundImage: 背景图片(字符串) |
|
319 |
|
|
320 |
````html |
|
321 |
<app-loading backgroundImage="图片地址"></app-loading> |
|
322 |
```` |
|
323 |
|
|
324 |
## app-text |
|
325 |
|
|
326 |
主题文字 |
|
327 |
|
|
328 |
- 代码 |
|
329 |
|
|
330 |
````html |
|
331 |
<app-text></app-text> |
|
332 |
```` |
|
333 |
|
|
334 |
- 属性 |
|
335 |
|
|
336 |
- theme: 主题色(字符串,变量)--- 变量需在props中定义 |
|
337 |
````html |
|
338 |
<app-text :theme="theme"></app-text> |
|
339 |
```` |
|
340 |
|
|
341 |
- fontSize: 文字大小 |
|
342 |
|
|
343 |
````html |
|
344 |
<app-text fontSize="23"></app-text> |
|
345 |
```` |
|
346 |
|
|
347 |
- color: 文字颜色 |
|
348 |
|
|
349 |
````html |
|
350 |
<app-text color="red"></app-text> |
|
351 |
```` |
|
352 |
|
|
353 |
## app-map |
|
354 |
|
|
355 |
注:字节跳动小程序不支持 |
|
356 |
|
|
357 |
- 代码 |
|
358 |
|
|
359 |
````html |
|
360 |
<!--#ifndef MP-TOUTIAO --> |
|
361 |
<app-map></app-map> |
|
362 |
<!-- #endif--> |
|
363 |
```` |
|
364 |
|
|
365 |
````javascript |
|
366 |
export default { |
|
367 |
data() { |
|
368 |
return { |
|
369 |
data: { |
|
370 |
backgroundColor: '#ffffff', |
|
371 |
backgroundPicUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
372 |
height: 400, |
|
373 |
latitude: '30.747440', |
|
374 |
location: '30.747440,120.784830', |
|
375 |
longitude: '120.784830', |
|
376 |
marginTop: 20, |
|
377 |
marginTopColor: "#ffffff", |
|
378 |
paddingX: 40, |
|
379 |
paddingY: 40, |
|
380 |
} |
|
381 |
} |
|
382 |
} |
|
383 |
} |
|
384 |
```` |
|
385 |
|
|
386 |
## app-copyright |
|
387 |
|
|
388 |
- 代码 |
|
389 |
|
|
390 |
````html |
|
391 |
<app-copyright :data="data"></app-copyright> |
|
392 |
```` |
|
393 |
|
|
394 |
````javascript |
|
395 |
export default { |
|
396 |
data() { |
|
397 |
return { |
|
398 |
data: { |
|
399 |
backgroundColor: 'red', |
|
400 |
link: { |
|
401 |
data: {}, |
|
402 |
openType: '', |
|
403 |
url: '', |
|
404 |
}, |
|
405 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
406 |
text: '禾匠科技', |
|
407 |
} |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |
```` |
|
412 |
|
|
413 |
## app-video |
|
414 |
|
|
415 |
- 代码 |
|
416 |
|
|
417 |
````html |
|
418 |
<app-video :newScrollTop="scrollTop"></app-video> |
|
419 |
```` |
|
420 |
|
|
421 |
````javascript |
|
422 |
export default { |
|
423 |
data() { |
|
424 |
return { |
|
425 |
scrollTop: 0 |
|
426 |
} |
|
427 |
}, |
|
428 |
onPageScroll: function(e) { |
|
429 |
this.$nextTick().then(() => { |
|
430 |
this.scrollTop = e.scrollTop; |
|
431 |
}); |
|
432 |
}, |
|
433 |
} |
|
434 |
```` |
|
435 |
|
|
436 |
## app-search-for |
|
437 |
|
|
438 |
- 代码 |
|
439 |
|
|
440 |
````html |
|
441 |
<app-search-for :data="data"></app-search-for> |
|
442 |
```` |
|
443 |
|
|
444 |
````javascript |
|
445 |
export default { |
|
446 |
data() { |
|
447 |
return { |
|
448 |
data: { |
|
449 |
background: `#968B8B`, |
|
450 |
color: '#DECACA', |
|
451 |
placeholder: '搜索', |
|
452 |
radius: 10, |
|
453 |
textColor: '#E8E3E3', |
|
454 |
textPosition: `left`, |
|
455 |
} |
|
456 |
} |
|
457 |
} |
|
458 |
} |
|
459 |
```` |
|
460 |
|
|
461 |
## app-quick-navigation |
|
462 |
|
|
463 |
- 代码 |
|
464 |
|
|
465 |
````html |
|
466 |
<app-quick-navigation :data="data"></app-quick-navigation> |
|
467 |
```` |
|
468 |
|
|
469 |
````javascript |
|
470 |
export default { |
|
471 |
data() { |
|
472 |
return { |
|
473 |
data: { |
|
474 |
closedPicUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
475 |
customerService: { |
|
476 |
opened: true, |
|
477 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
478 |
}, |
|
479 |
home: { |
|
480 |
opened: true, |
|
481 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
482 |
}, |
|
483 |
mApp: { |
|
484 |
appId: '', |
|
485 |
opened: false, |
|
486 |
page: '', |
|
487 |
picUrl: '', |
|
488 |
}, |
|
489 |
mapNav: { |
|
490 |
address: '南湖', |
|
491 |
latitude: '30.762457', |
|
492 |
location: '', |
|
493 |
longitude: '120.763779', |
|
494 |
opened: true, |
|
495 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg' |
|
496 |
}, |
|
497 |
navStyle: 1, |
|
498 |
navSwitch: 1, |
|
499 |
openedPicUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
500 |
tel: { |
|
501 |
number: '1885813481', |
|
502 |
opened: true, |
|
503 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
504 |
}, |
|
505 |
useMallConfig: false, |
|
506 |
web: { |
|
507 |
opened: true, |
|
508 |
picUrl: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
509 |
url: 'www.baidu.com', |
|
510 |
}, |
|
511 |
} |
|
512 |
} |
|
513 |
} |
|
514 |
} |
|
515 |
```` |
|
516 |
|
|
517 |
## app-navigation-icon |
|
518 |
|
|
519 |
- 代码 |
|
520 |
|
|
521 |
```html |
|
522 |
<app-navigation-icon :data="data"></app-navigation-icon> |
|
523 |
``` |
|
524 |
|
|
525 |
````javascript |
|
526 |
export default { |
|
527 |
data() { |
|
528 |
return { |
|
529 |
data: { |
|
530 |
background: "#C42929", |
|
531 |
color: "#1358EE", |
|
532 |
columns: 3, |
|
533 |
navs: [ |
|
534 |
{ |
|
535 |
icon: "http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg", |
|
536 |
icon_url: "http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg", |
|
537 |
link_url: "/pages/index/index", |
|
538 |
name: "导航13", |
|
539 |
openType: "navigate", |
|
540 |
open_type: "navigate", |
|
541 |
url: "/pages/index/index", |
|
542 |
}, |
|
543 |
], |
|
544 |
rows: 4, |
|
545 |
scroll: true, |
|
546 |
} |
|
547 |
} |
|
548 |
} |
|
549 |
} |
|
550 |
```` |
|
551 |
|
|
552 |
## app-announcement |
|
553 |
|
|
554 |
- 代码 |
|
555 |
|
|
556 |
````html |
|
557 |
<app-announcement :data="data"></app-announcement> |
|
558 |
```` |
|
559 |
|
|
560 |
````javascript |
|
561 |
export default { |
|
562 |
data() { |
|
563 |
return { |
|
564 |
data: { |
|
565 |
background: '#f67f79', |
|
566 |
btnColor: '#ff4544', |
|
567 |
btnHeight: 80, |
|
568 |
btnRadius: 40, |
|
569 |
btnText: '我知道了', |
|
570 |
btnTextColor: '#ffffff', |
|
571 |
btnWidth: 500, |
|
572 |
content: 'sdfsdfsdfwerr2323232323232323232323232323232323232323232323232323232323232323232323', |
|
573 |
headerUrl: 'https://www.bangdian.net/plugins/diy/assets/images/icon-notice-title.png', |
|
574 |
icon: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
575 |
name: '公告', |
|
576 |
textColor: "#ffffff", |
|
577 |
} |
|
578 |
} |
|
579 |
} |
|
580 |
} |
|
581 |
```` |
|
582 |
|
|
583 |
## app-special-topic-normal |
|
584 |
|
|
585 |
- 代码 |
|
586 |
|
|
587 |
````html |
|
588 |
<template v-if="data.style === 'normal'"> |
|
589 |
<app-special-topic-normal :data="data"></app-special-topic-normal> |
|
590 |
</template> |
|
591 |
```` |
|
592 |
|
|
593 |
````javascript |
|
594 |
export default { |
|
595 |
data() { |
|
596 |
return { |
|
597 |
data: { |
|
598 |
cat_show: false, |
|
599 |
count: 2, |
|
600 |
icon: "https://www.bangdian.net/web/statics/img/app/topic/icon-topic-r.png", |
|
601 |
list: [], |
|
602 |
logo_1: "https://www.bangdian.net/web/statics/img/app/topic/icon-topic-1.png", |
|
603 |
logo_2: "https://www.bangdian.net/web/statics/img/app/topic/icon-topic-2.png", |
|
604 |
style: "normal", |
|
605 |
topic_list: [ |
|
606 |
{ |
|
607 |
cover_pic: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
608 |
id: 14, |
|
609 |
layout: 0, |
|
610 |
read_count: '0人浏览', |
|
611 |
title: '专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一专题一', |
|
612 |
} |
|
613 |
], |
|
614 |
} |
|
615 |
} |
|
616 |
} |
|
617 |
} |
|
618 |
```` |
|
619 |
|
|
620 |
## app-special-topic-list |
|
621 |
|
|
622 |
- 代码 |
|
623 |
|
|
624 |
````html |
|
625 |
<template v-if="data.style === 'list'"> |
|
626 |
<app-special-topic-normal :topic_list="topic_list" :list="list" :cat_show="cat_show"></app-special-topic-normal> |
|
627 |
</template> |
|
628 |
```` |
|
629 |
|
|
630 |
````javascript |
|
631 |
export default { |
|
632 |
data() { |
|
633 |
return { |
|
634 |
cat_show: { |
|
635 |
type: Boolean, |
|
636 |
default: function() { |
|
637 |
return false; |
|
638 |
} |
|
639 |
}, |
|
640 |
list: { |
|
641 |
type: Array, |
|
642 |
default: function() { |
|
643 |
return [ |
|
644 |
{ |
|
645 |
cat_id: '18', |
|
646 |
cat_name: '123', |
|
647 |
children: [ |
|
648 |
], |
|
649 |
custom: false, |
|
650 |
name: '附页', |
|
651 |
number: 30, |
|
652 |
}, |
|
653 |
{ |
|
654 |
cat_id: '18', |
|
655 |
cat_name: '123', |
|
656 |
children: [ |
|
657 |
{ |
|
658 |
cover_pic: 'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
659 |
id: 14, |
|
660 |
layout: 0, |
|
661 |
read_count: '0人浏览', |
|
662 |
title: '专题一', |
|
663 |
} |
|
664 |
], |
|
665 |
custom: false, |
|
666 |
name: '首页', |
|
667 |
number: 30, |
|
668 |
} |
|
669 |
]; |
|
670 |
} |
|
671 |
}, |
|
672 |
topic_list: { |
|
673 |
type: Array, |
|
674 |
default: function() { |
|
675 |
return [ |
|
676 |
{ |
|
677 |
cover_pic:'http://www.bangdian.net/web/uploads/mall51/20190724/3d3abd2944d5d32b9a9780fd3525bb50.jpg', |
|
678 |
id: 15, |
|
679 |
layout:1, |
|
680 |
read_count: '0人浏览', |
|
681 |
title: '专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二专题二', |
|
682 |
} |
|
683 |
] |
|
684 |
} |
|
685 |
} |
|
686 |
} |
|
687 |
} |
|
688 |
} |
|
689 |
```` |
|
690 |
|
|
691 |
## app-tab-nav |
|
692 |
|
|
693 |
- 代码 |
|
694 |
|
|
695 |
````html |
|
696 |
<app-tab-nav setHeight="90" fontSize="32" :tabList="tabList" :activeItem="activeTab" @click="tabStatus" :theme="theme"></app-tab-nav> |
|
697 |
```` |
|
698 |
|
|
699 |
- 属性 |
|
700 |
|
|
701 |
- setHeight: 组件高度,不传,默认为90rpx(字符串)--- 单位为rpx,不需要传 |
|
702 |
|
|
703 |
- fontSize: 字体大小,不传,默认为28rpx(字符串)--- 单位为rpx,不需要传 |
|
704 |
|
|
705 |
- tabList: 数组,需要显示的tab栏,需name和id字段 |
|
706 |
|
|
707 |
- activeItem: 当前激活的tab的id |
|
708 |
|
|
709 |
- theme: 主题色 |
|
710 |
|
|
711 |
- tabStatus: 字体大小,不传,默认为32rpx(字符串)--- 单位为rpx,不需要传 |
|
712 |
|
|
713 |
- click: 点击事件,事件名称可自定义 |
|
714 |
|
|
715 |
````javascript |
|
716 |
export default { |
|
717 |
data() { |
|
718 |
return { |
|
719 |
tabList: [ |
|
720 |
{id:1, name: '商品'}, |
|
721 |
{id:2, name: '专题'} |
|
722 |
], |
|
723 |
activeTab: 1, |
|
724 |
} |
|
725 |
}, |
|
726 |
methods: { |
|
727 |
tabStatus(e) { |
|
728 |
console.log(e) |
|
729 |
}, |
|
730 |
} |
|
731 |
} |
|
732 |
```` |
|
733 |
|
|
734 |
## app-reservation |
|
735 |
|
|
736 |
- 代码 |
|
737 |
|
|
738 |
````html |
|
739 |
<app-reservation></app-reservation> |
|
740 |
```` |
|
741 |
|
|
742 |
````javascript |
|
743 |
export default { |
|
744 |
props: { |
|
745 |
buttonColor: { |
|
746 |
type: String, |
|
747 |
default: function() { |
|
748 |
return "blue"; |
|
749 |
} |
|
750 |
}, |
|
751 |
buyBtnStyle: { |
|
752 |
type: Number, |
|
753 |
default: function() { |
|
754 |
return 4; |
|
755 |
} |
|
756 |
}, |
|
757 |
buyBtnText: { |
|
758 |
type: String, |
|
759 |
default: function() { |
|
760 |
return "预约"; |
|
761 |
} |
|
762 |
}, |
|
763 |
customizeGoodsTag: { |
|
764 |
type: Boolean, |
|
765 |
default: function() { |
|
766 |
return false; |
|
767 |
} |
|
768 |
}, |
|
769 |
fill: { |
|
770 |
type: Number, |
|
771 |
default: function() { |
|
772 |
return 0; |
|
773 |
} |
|
774 |
}, |
|
775 |
goodsCoverProportion: { |
|
776 |
type: String, |
|
777 |
default: function() { |
|
778 |
return "3-2"; |
|
779 |
} |
|
780 |
}, |
|
781 |
goodsStyle: { |
|
782 |
type: Number, |
|
783 |
default: function() { |
|
784 |
return 3; |
|
785 |
} |
|
786 |
}, |
|
787 |
goodsTagPicUrl: { |
|
788 |
type: String, |
|
789 |
default: function() { |
|
790 |
return "http://v4test2.zjhejiang.com/plugins/diy/assets/images/goods-tag-xp.png"; |
|
791 |
} |
|
792 |
}, |
|
793 |
list: { |
|
794 |
type: Array, |
|
795 |
default: function() { |
|
796 |
return [ |
|
797 |
{ |
|
798 |
cover_pic: "http://matianxia.oss-cn-qingdao.aliyuncs.com/uploads/20190426/ba493adde2ed99593821c1b5816e6775.png?x-oss-process=style/q90", |
|
799 |
id: 13, |
|
800 |
name: "TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST1", |
|
801 |
page_url: "/plugins/book/goods/goods?goods_id=13", |
|
802 |
price: "0.00", |
|
803 |
price_content: "¥0.00", |
|
804 |
}, |
|
805 |
{ |
|
806 |
cover_pic: "http://matianxia.oss-cn-qingdao.aliyuncs.com/uploads/20190428/3609e08f1dfa8c9c8449808b93331a36.png?x-oss-process=style/q90", |
|
807 |
id: 47, |
|
808 |
name: "预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】预约商品【免费】", |
|
809 |
page_url: "/plugins/book/goods/goods?goods_id=47", |
|
810 |
price: "10.00", |
|
811 |
price_content: "¥10.00", |
|
812 |
}, |
|
813 |
]; |
|
814 |
} |
|
815 |
}, |
|
816 |
listStyle: { |
|
817 |
type: Number, |
|
818 |
default: function() { |
|
819 |
return 1; |
|
820 |
} |
|
821 |
}, |
|
822 |
showBuyBtn: { |
|
823 |
type: Boolean, |
|
824 |
default: function() { |
|
825 |
return true; |
|
826 |
} |
|
827 |
}, |
|
828 |
showGoodsName: { |
|
829 |
type: Boolean, |
|
830 |
default: function() { |
|
831 |
return false; |
|
832 |
} |
|
833 |
}, |
|
834 |
showGoodsTag: { |
|
835 |
type: Boolean, |
|
836 |
default: function() { |
|
837 |
return false; |
|
838 |
} |
|
839 |
}, |
|
840 |
scrollTop: { |
|
841 |
type: Number, |
|
842 |
default: function() { |
|
843 |
return 0; |
|
844 |
} |
|
845 |
}, |
|
846 |
value: { |
|
847 |
type: Boolean, |
|
848 |
default: function() { |
|
849 |
return true; |
|
850 |
} |
|
851 |
} |
|
852 |
} |
|
853 |
} |
|
854 |
```` |
|
855 |
|
|
856 |
## app-model |
|
857 |
|
|
858 |
- 代码 |
|
859 |
|
|
860 |
````html |
|
861 |
<app-model v-model="input"> |
|
862 |
<view slot="title"></view> |
|
863 |
<view slot="content"></view> |
|
864 |
</app-model> |
|
865 |
```` |
|
866 |
|
|
867 |
````javascript |
|
868 |
export default { |
|
869 |
data() { |
|
870 |
return { |
|
871 |
input: false, |
|
872 |
} |
|
873 |
}, |
|
874 |
methods: { |
|
875 |
openHidden() { |
|
876 |
this.input = !this.input; |
|
877 |
} |
|
878 |
} |
|
879 |
} |
|
880 |
```` |
|
881 |
|
|
882 |
## app-image-ad |
|
883 |
|
|
884 |
- 代码 |
|
885 |
|
|
886 |
````html |
|
887 |
<app-image-ad></app-image-ad> |
|
888 |
```` |
|
889 |
|
|
890 |
``````javascript |
|
891 |
export default { |
|
892 |
props: { |
|
893 |
h: { |
|
894 |
type: Number, |
|
895 |
default: function() { |
|
896 |
return 1; |
|
897 |
} |
|
898 |
}, |
|
899 |
height: { |
|
900 |
default: function() { |
|
901 |
return 750; |
|
902 |
} |
|
903 |
}, |
|
904 |
hotspot: { |
|
905 |
type: Array, |
|
906 |
default: function() { |
|
907 |
return []; |
|
908 |
} |
|
909 |
}, |
|
910 |
list: { |
|
911 |
type: Array, |
|
912 |
default: function() { |
|
913 |
return [ |
|
914 |
]; |
|
915 |
} |
|
916 |
}, |
|
917 |
space: { |
|
918 |
type: Number, |
|
919 |
default: function() { |
|
920 |
return 0; |
|
921 |
} |
|
922 |
}, |
|
923 |
style: { |
|
924 |
type: Number, |
|
925 |
default: function() { |
|
926 |
return 1; |
|
927 |
} |
|
928 |
}, |
|
929 |
w: { |
|
930 |
type: Number, |
|
931 |
default: function() { |
|
932 |
return 25; |
|
933 |
} |
|
934 |
} |
|
935 |
}, |
|
936 |
} |
|
937 |
`````` |
|
938 |
|
|
939 |
## app-diy-form |
|
940 |
|
|
941 |
自定义表单 |
|
942 |
|
|
943 |
- 代码 |
|
944 |
|
|
945 |
```vue |
|
946 |
<app-diy-form |
|
947 |
:list="formList" |
|
948 |
:sign="anyValue" |
|
949 |
@input="handleInput" |
|
950 |
@validate="handleValidate"></app-diy-form> |
|
951 |
|
|
952 |
<script> |
|
953 |
export default { |
|
954 |
methods: { |
|
955 |
handleInput(result, sign) { |
|
956 |
}, |
|
957 |
handleValidate(result, sign) { |
|
958 |
}, |
|
959 |
} |
|
960 |
} |
|
961 |
</script> |
|
962 |
``` |
|
963 |
|
|
964 |
- 属性 |
|
965 |
|
|
966 |
- title: String,表单标题 |
|
967 |
|
|
968 |
- list: Object,传入的表单数据,实例值: |
|
969 |
|
|
970 |
``` |
|
971 |
[ |
|
972 |
{ |
|
973 |
key: 'text', // 类型(text,textarea,date,time,radio,checkbox,img_upload) |
|
974 |
name: '姓名', // 名称 |
|
975 |
default: null, // 默认值 |
|
976 |
}, |
|
977 |
{ |
|
978 |
key: 'radio', |
|
979 |
name: '性别', |
|
980 |
default: null, |
|
981 |
list: [ |
|
982 |
{label: '男', value: false}, |
|
983 |
{label: '女', value: true}, |
|
984 |
{label: '隐私', value: false} |
|
985 |
], |
|
986 |
}, |
|
987 |
{ |
|
988 |
key: 'checkbox', |
|
989 |
name: '其他', |
|
990 |
default: null, |
|
991 |
list: [ |
|
992 |
{label: '不要辣', value: false}, |
|
993 |
{label: '不加葱', value: true}, |
|
994 |
{label: '多加盐', value: true} |
|
995 |
], |
|
996 |
}, |
|
997 |
{ |
|
998 |
key: 'img_upload', |
|
999 |
name: '头像', |
|
1000 |
default: null, |
|
1001 |
}, |
|
1002 |
... |
|
1003 |
] |
|
1004 |
``` |
|
1005 |
|
|
1006 |
- sign: Any,自定义传入参数,@input|@validate时将返回 |
|
1007 |
|
|
1008 |
- 事件 |
|
1009 |
|
|
1010 |
- @input: 表单值有更新时触发,返回值: |
|
1011 |
|
|
1012 |
- data: 表单内容,示例: |
|
1013 |
|
|
1014 |
``` |
|
1015 |
[ |
|
1016 |
{ |
|
1017 |
key: 'text', // 类型(text,textarea,date,time,radio,checkbox,img_upload) |
|
1018 |
name: '姓名', // 名称 |
|
1019 |
default: null, // 默认值 |
|
1020 |
value: '张三', // 表单值 |
|
1021 |
}, |
|
1022 |
{ |
|
1023 |
key: 'radio', |
|
1024 |
name: '性别', |
|
1025 |
default: null, |
|
1026 |
list: [ |
|
1027 |
{label: '男', value: false}, |
|
1028 |
{label: '女', value: true}, |
|
1029 |
{label: '隐私', value: false} |
|
1030 |
], |
|
1031 |
value: '女', |
|
1032 |
}, |
|
1033 |
{ |
|
1034 |
key: 'checkbox', |
|
1035 |
name: '其他', |
|
1036 |
default: null, |
|
1037 |
list: [ |
|
1038 |
{label: '不要辣', value: false}, |
|
1039 |
{label: '不加葱', value: true}, |
|
1040 |
{label: '多加盐', value: true} |
|
1041 |
], |
|
1042 |
value: ['不加葱', '多加盐'], |
|
1043 |
}, |
|
1044 |
{ |
|
1045 |
key: 'img_upload', |
|
1046 |
name: '头像', |
|
1047 |
default: null, |
|
1048 |
value: 'http://xxx.xxx/abc.jpg', |
|
1049 |
}, |
|
1050 |
... |
|
1051 |
] |
|
1052 |
``` |
|
1053 |
|
|
1054 |
- sign: 自定义传入的值 |
|
1055 |
|
|
1056 |
- @validate: 表单验证返回结果,返回值 |
|
1057 |
|
|
1058 |
- result: 验证结果,示例: |
|
1059 |
|
|
1060 |
``` |
|
1061 |
{ |
|
1062 |
hasError: false, // 表单填写内容是否有错误 |
|
1063 |
errors: [ |
|
1064 |
{ |
|
1065 |
index: 0, // 第几个表单 |
|
1066 |
msg: '"姓名不能为空"', // 错误信息 |
|
1067 |
}, |
|
1068 |
] |
|
1069 |
} |
|
1070 |
``` |
|
1071 |
|
|
1072 |
- sign: 自定义传入的值 |