Commit 3d813db7c2526e5b536c69a109e132dde71abc91

Authored by ly525
1 parent 91e1cbad

feat(plugin): add rate componnet; #!zh: 增加评分组件

front-end/h5/src/components/plugins/lbp-rate.js 0 → 100644
  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
... ... @@ -12,6 +12,8 @@ import LbpBackground from &#39;../components/plugins/lbp-background&#39;
12 12 import LbpSlide from '../components/plugins/lbp-slide'
13 13 import LbpBgMusic from '../components/plugins/lbp-bg-music'
14 14 import LbpNoticeBar from '../components/plugins/lbp-notice-bar'
  15 +import LbpRate from '../components/plugins/lbp-rate'
  16 +// import LbpTabs from '../components/plugins/lbp-tabs'
15 17  
16 18 export const pluginsList = [
17 19 {
... ... @@ -25,6 +27,28 @@ export const pluginsList = [
25 27 visible: true,
26 28 name: LbpNoticeBar.name
27 29 },
  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 + },
28 52 {
29 53 title: '图片',
30 54 i18nTitle: {
... ...