Skip to content

Commit 3d813db

Browse files
committed
feat(plugin): add rate componnet; #!zh: 增加评分组件
1 parent 91e1cba commit 3d813db

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* @Author: ly525
3+
* @Date: 2020-05-17 20:04:23
4+
* @LastEditors: ly525
5+
* @LastEditTime: 2020-05-17 21:33:31
6+
* @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-rate.js
7+
* @Github: https://github.com/ly525/luban-h5
8+
* @Description: Do not edit
9+
* @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10+
*/
11+
import PropTypes from '@luban-h5/plugin-common-props'
12+
import { Rate } from 'vant'
13+
import 'vant/lib/rate/style'
14+
import 'vant/lib/icon/local.css'
15+
16+
export default {
17+
name: 'lbp-rate',
18+
props: {
19+
value: PropTypes.number({
20+
defaultValue: 5,
21+
label: '当前分值'
22+
}),
23+
count: PropTypes.number({
24+
defaultValue: 5,
25+
label: '图标总数'
26+
}),
27+
size: PropTypes.number({
28+
defaultValue: 16,
29+
label: '图标大小'
30+
}),
31+
gutter: PropTypes.number({
32+
defaultValue: 16,
33+
label: '图标间距'
34+
}),
35+
mode: {
36+
type: String,
37+
default: '',
38+
editor: {
39+
type: 'a-select',
40+
label: '模式',
41+
props: {
42+
options: [
43+
{
44+
label: 'star',
45+
value: 'star'
46+
},
47+
{
48+
label: '点赞',
49+
value: 'like'
50+
},
51+
{
52+
label: 'Good',
53+
value: 'good-job'
54+
}
55+
]
56+
}
57+
}
58+
}
59+
},
60+
componentsForPropsEditor: {
61+
},
62+
mounted () {
63+
},
64+
methods: {
65+
66+
},
67+
render () {
68+
return <Rate
69+
value={this.value}
70+
count={this.count}
71+
size={this.size}
72+
color={this.color}
73+
gutter={this.gutter}
74+
void-icon="star"
75+
void-color="#eee"
76+
/>
77+
}
78+
}

front-end/h5/src/mixins/load-plugins.js

+24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import LbpBackground from '../components/plugins/lbp-background'
1212
import LbpSlide from '../components/plugins/lbp-slide'
1313
import LbpBgMusic from '../components/plugins/lbp-bg-music'
1414
import LbpNoticeBar from '../components/plugins/lbp-notice-bar'
15+
import LbpRate from '../components/plugins/lbp-rate'
16+
// import LbpTabs from '../components/plugins/lbp-tabs'
1517

1618
export const pluginsList = [
1719
{
@@ -25,6 +27,28 @@ export const pluginsList = [
2527
visible: true,
2628
name: LbpNoticeBar.name
2729
},
30+
// {
31+
// title: '标签页',
32+
// i18nTitle: {
33+
// 'en-US': 'Tabs',
34+
// 'zh-CN': '标签页'
35+
// },
36+
// icon: 'tab',
37+
// component: LbpTabs,
38+
// visible: true,
39+
// name: LbpTabs.name
40+
// },
41+
{
42+
title: '评分',
43+
i18nTitle: {
44+
'en-US': 'Rate',
45+
'zh-CN': '评分'
46+
},
47+
icon: 'star-o',
48+
component: LbpRate,
49+
visible: true,
50+
name: LbpRate.name
51+
},
2852
{
2953
title: '图片',
3054
i18nTitle: {

0 commit comments

Comments
 (0)