Commit 30b96927872d4e2a6173a08c0d0f82d24e272ee7

Authored by ly525
1 parent c6612749

feat(PropTypes): upgrade PropTypes from object to function; #!zh: 升级 PropTypes: 更新为函数, 便于后期扩展

front-end/h5/package.json
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 "@luban-h5/lbc-button": "^0.0.3", 17 "@luban-h5/lbc-button": "^0.0.3",
18 "@luban-h5/lbp-slide": "^0.0.7", 18 "@luban-h5/lbp-slide": "^0.0.7",
19 "@luban-h5/lbs-text-align": "^0.0.3", 19 "@luban-h5/lbs-text-align": "^0.0.3",
20 - "@luban-h5/plugin-common-props": "^0.0.2", 20 + "@luban-h5/plugin-common-props": "^0.1.3",
21 "animate.css": "^3.7.2", 21 "animate.css": "^3.7.2",
22 "ant-design-vue": "^1.3.14", 22 "ant-design-vue": "^1.3.14",
23 "core-js": "^2.6.5", 23 "core-js": "^2.6.5",
front-end/h5/src/components/core/editor/edit-panel/props.js
@@ -74,7 +74,7 @@ export default { @@ -74,7 +74,7 @@ export default {
74 const data = { 74 const data = {
75 // style: { width: '100%' }, 75 // style: { width: '100%' },
76 props: { 76 props: {
77 - ...item.prop || {}, 77 + ...item.props || {},
78 // https://vuejs.org/v2/guide/render-function.html#v-model 78 // https://vuejs.org/v2/guide/render-function.html#v-model
79 79
80 // #!zh:不设置默认值的原因(下一行的代码,注释的代码): 80 // #!zh:不设置默认值的原因(下一行的代码,注释的代码):
front-end/h5/src/components/plugins/lbp-background.js
@@ -2,12 +2,14 @@ @@ -2,12 +2,14 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-11-24 18:51:58 3 * @Date: 2019-11-24 18:51:58
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2020-04-23 23:17:55 5 + * @LastEditTime: 2020-05-17 21:02:47
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-background.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-background.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: luban-h5 background image/color component/plugin 8 * @Description: luban-h5 background image/color component/plugin
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
  11 +import PropTypes from '@luban-h5/plugin-common-props'
  12 +
11 export default { 13 export default {
12 name: 'lbp-background', 14 name: 'lbp-background',
13 render () { 15 render () {
@@ -39,34 +41,7 @@ export default { @@ -39,34 +41,7 @@ export default {
39 ) 41 )
40 }, 42 },
41 props: { 43 props: {
42 - imgSrc: {  
43 - type: String,  
44 - default: '',  
45 - editor: {  
46 - type: 'lbs-image-gallery',  
47 - label: '图片',  
48 - prop: {  
49 - type: 'textarea'  
50 - }  
51 - }  
52 - },  
53 - backgroundColor: {  
54 - type: String,  
55 - // Q: 为什么 transparent 无效?  
56 - // A: 注意,根据 MDN 文档,颜色选择器的 value 只能是:# + 6个16进制字符串  
57 - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color#Value  
58 - // The value of an <input> element of type color is always a DOMString which contains a 7-character string specifying an RGB color in hexadecimal format.  
59 -  
60 - default: 'rgba(255, 255, 255, 0.2)',  
61 - editor: {  
62 - type: 'el-color-picker',  
63 - label: '背景颜色',  
64 - prop: {  
65 - size: 'mini',  
66 - showAlpha: true  
67 - },  
68 - require: true  
69 - }  
70 - } 44 + imgSrc: PropTypes.image(),
  45 + backgroundColor: PropTypes.color({ label: '背景色', defaultValue: 'rgba(255, 255, 255, 0.2)' })
71 } 46 }
72 } 47 }
front-end/h5/src/components/plugins/lbp-bg-music.js
1 /* 1 /*
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2020-01-03 23:43:34 3 * @Date: 2020-01-03 23:43:34
4 - * @LastEditors : ly525  
5 - * @LastEditTime : 2020-01-04 13:27:58 4 + * @LastEditors: ly525
  5 + * @LastEditTime: 2020-05-17 20:58:32
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-bg-music.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-bg-music.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: Do not edit 8 * @Description: Do not edit
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
  11 +import PropTypes from '@luban-h5/plugin-common-props'
11 import './styles/bg-music.scss' 12 import './styles/bg-music.scss'
12 13
13 export default { 14 export default {
14 name: 'lbp-bg-music', 15 name: 'lbp-bg-music',
15 props: { 16 props: {
16 - disabled: {  
17 - type: Boolean,  
18 - default: true  
19 - },  
20 - autoplay: {  
21 - type: Boolean,  
22 - default: true,  
23 - editor: {  
24 - type: 'a-switch',  
25 - label: '自动播放' 17 + disabled: PropTypes.boolean({
  18 + defaultValue: true,
  19 + label: 'disabled'
  20 + }),
  21 + autoplay: PropTypes.boolean({
  22 + defaultValue: true,
  23 + label: '自动播放'
  24 + }),
  25 + src: PropTypes.string({
  26 + label: '音乐URL',
  27 + defaultValue: 'http://go.163.com/2018/0209/mengniu/audio/bgm.mp3',
  28 + props: {
  29 + type: 'textarea'
26 } 30 }
27 - },  
28 - src: {  
29 - type: String,  
30 - default: 'http://go.163.com/2018/0209/mengniu/audio/bgm.mp3',  
31 - editor: {  
32 - type: 'a-input',  
33 - label: '音乐URL',  
34 - prop: {  
35 - type: 'textarea'  
36 - }  
37 - }  
38 - } 31 + })
39 }, 32 },
40 data: () => ({ 33 data: () => ({
41 isPlaying: true 34 isPlaying: true
front-end/h5/src/components/plugins/lbp-button.js
1 // https://github.com/luban-h5-components/plugin-common-props 1 // https://github.com/luban-h5-components/plugin-common-props
2 -import commonProps from '@luban-h5/plugin-common-props' 2 +import PropTypes from '@luban-h5/plugin-common-props'
3 3
4 export default { 4 export default {
5 render () { 5 render () {
@@ -33,16 +33,15 @@ export default { @@ -33,16 +33,15 @@ export default {
33 }, 33 },
34 name: 'lbp-button', 34 name: 'lbp-button',
35 props: { 35 props: {
36 - text: commonProps.text(),  
37 - vertical: commonProps.vertical,  
38 - backgroundColor: commonProps.backgroundColor,  
39 - color: commonProps.color,  
40 - fontSize: commonProps.fontSize,  
41 - lineHeight: commonProps.lineHeight,  
42 - borderWidth: commonProps.borderWidth,  
43 - borderRadius: commonProps.borderRadius,  
44 - borderColor: commonProps.borderColor,  
45 - textAlign: commonProps.textAlign()  
46 - 36 + text: PropTypes.string(),
  37 + vertical: PropTypes.boolean(),
  38 + backgroundColor: PropTypes.color({ label: '背景色', defaultValue: 'rgba(255, 255, 255, 0.2)' }),
  39 + color: PropTypes.color(),
  40 + fontSize: PropTypes.number({ label: '字号(px)' }),
  41 + lineHeight: PropTypes.number({ label: '行高(px)', defaultValue: 1 }),
  42 + borderWidth: PropTypes.number({ label: '边框宽度(px)', defaultValue: 1 }),
  43 + borderRadius: PropTypes.number({ label: '圆角(px)', defaultValue: 4 }),
  44 + borderColor: PropTypes.color({ label: '边框颜色', defaultValue: '#ced4da' }),
  45 + textAlign: PropTypes.textAlign()
47 } 46 }
48 } 47 }
front-end/h5/src/components/plugins/lbp-form-button.js
1 // https://github.com/luban-h5-components/plugin-common-props 1 // https://github.com/luban-h5-components/plugin-common-props
2 -import commonProps from '@luban-h5/plugin-common-props' 2 +import PropTypes from '@luban-h5/plugin-common-props'
3 3
4 export default { 4 export default {
5 render () { 5 render () {
@@ -36,16 +36,16 @@ export default { @@ -36,16 +36,16 @@ export default {
36 }, 36 },
37 name: 'lbp-form-button', 37 name: 'lbp-form-button',
38 props: { 38 props: {
39 - text: commonProps.text(),  
40 - vertical: commonProps.vertical,  
41 - backgroundColor: commonProps.backgroundColor,  
42 - color: commonProps.color,  
43 - fontSize: commonProps.fontSize,  
44 - lineHeight: commonProps.lineHeight,  
45 - borderWidth: commonProps.borderWidth,  
46 - borderRadius: commonProps.borderRadius,  
47 - borderColor: commonProps.borderColor,  
48 - textAlign: commonProps.textAlign(), 39 + text: PropTypes.string({ defaultValue: '提交' }),
  40 + vertical: PropTypes.boolean(),
  41 + backgroundColor: PropTypes.color({ label: '背景色', defaultValue: 'rgba(255, 255, 255, 0.2)' }),
  42 + color: PropTypes.color(),
  43 + fontSize: PropTypes.number({ label: '字号(px)' }),
  44 + lineHeight: PropTypes.number({ label: '行高(px)', defaultValue: 1 }),
  45 + borderWidth: PropTypes.number({ label: '边框宽度(px)', defaultValue: 1 }),
  46 + borderRadius: PropTypes.number({ label: '圆角(px)', defaultValue: 4 }),
  47 + borderColor: PropTypes.color({ label: '边框颜色', defaultValue: '#ced4da' }),
  48 + textAlign: PropTypes.textAlign(),
49 disabled: { 49 disabled: {
50 type: Boolean, 50 type: Boolean,
51 default: false 51 default: false
front-end/h5/src/components/plugins/lbp-form-checkbox-group.js
  1 +import PropTypes from '@luban-h5/plugin-common-props'
1 import LbpFormRadio from './lbp-form-radio.js' 2 import LbpFormRadio from './lbp-form-radio.js'
2 3
3 function getDefaultItems () { 4 function getDefaultItems () {
@@ -26,24 +27,15 @@ export default { @@ -26,24 +27,15 @@ export default {
26 LbpFormRadio 27 LbpFormRadio
27 }, 28 },
28 props: { 29 props: {
29 - aliasName: {  
30 - type: String,  
31 - default: `标题演示`,  
32 - editor: {  
33 - type: 'a-input',  
34 - label: '填写标题',  
35 - require: true  
36 - }  
37 - },  
38 - items: {  
39 - type: Array,  
40 - default: () => getDefaultItems(),  
41 - editor: {  
42 - type: 'lbs-prop-text-enum-editor',  
43 - label: '选项列表',  
44 - require: true  
45 - }  
46 - }, 30 + aliasName: PropTypes.string({
  31 + defaultValue: '标题演示',
  32 + label: '填写标题'
  33 + }),
  34 + items: PropTypes.textOptions({
  35 + label: '选项列表',
  36 + defaultValue: () => getDefaultItems()
  37 + }),
  38 + // TODO 抽离 radio-group 至 common-props
47 type: { 39 type: {
48 type: String, 40 type: String,
49 default: 'checkbox', 41 default: 'checkbox',
@@ -51,7 +43,7 @@ export default { @@ -51,7 +43,7 @@ export default {
51 type: 'a-radio-group', 43 type: 'a-radio-group',
52 label: '选择模式', 44 label: '选择模式',
53 require: true, 45 require: true,
54 - prop: { 46 + props: {
55 options: [ 47 options: [
56 { label: '单选', value: 'radio' }, 48 { label: '单选', value: 'radio' },
57 { label: '多选', value: 'checkbox' } 49 { label: '多选', value: 'checkbox' }
front-end/h5/src/components/plugins/lbp-form-input.js
1 // https://github.com/luban-h5-components/plugin-common-props 1 // https://github.com/luban-h5-components/plugin-common-props
2 -import commonProps from '@luban-h5/plugin-common-props' 2 +import PropTypes from '@luban-h5/plugin-common-props'
3 3
4 export default { 4 export default {
5 name: 'lbp-form-input', 5 name: 'lbp-form-input',
@@ -26,12 +26,6 @@ export default { @@ -26,12 +26,6 @@ export default {
26 /> 26 />
27 }, 27 },
28 props: { 28 props: {
29 - name: {  
30 - type: String,  
31 - default () {  
32 - return 'name'  
33 - }  
34 - },  
35 type: { 29 type: {
36 type: String, 30 type: String,
37 default: 'text', 31 default: 'text',
@@ -40,20 +34,18 @@ export default { @@ -40,20 +34,18 @@ export default {
40 label: '类型' 34 label: '类型'
41 } 35 }
42 }, 36 },
43 - disabled: {  
44 - type: Boolean,  
45 - default: false  
46 - },  
47 - // type: commonProps.type,  
48 - placeholder: commonProps.placeholder('姓名'),  
49 - fontSize: commonProps.fontSize,  
50 - color: commonProps.color,  
51 - backgroundColor: commonProps.backgroundColor,  
52 - borderColor: commonProps.borderColor,  
53 - borderWidth: commonProps.borderWidth,  
54 - borderRadius: commonProps.borderRadius,  
55 - lineHeight: commonProps.lineHeight,  
56 - textAlign: commonProps.textAlign({ defaultValue: 'left' }) 37 + name: PropTypes.string({ defaultValue: 'name', label: 'name' }),
  38 + disabled: PropTypes.boolean({ label: 'disabled' }),
  39 + fontSize: PropTypes.number({ label: '字号(px)' }),
  40 + placeholder: PropTypes.string({ defaultValue: '提示信息', label: '提示信息' }),
  41 + color: PropTypes.color(),
  42 + backgroundColor: PropTypes.color({ label: '背景色', defaultValue: 'rgba(255, 255, 255, 0.2)' }),
  43 + borderWidth: PropTypes.number({ label: '边框宽度(px)', defaultValue: 1 }),
  44 + borderRadius: PropTypes.number({ label: '圆角(px)', defaultValue: 0 }),
  45 + borderColor: PropTypes.color({ label: '边框颜色', defaultValue: '#ced4da' }),
  46 + textAlign: PropTypes.textAlign({ defaultValue: 'left' }),
  47 + vertical: PropTypes.boolean(),
  48 + lineHeight: PropTypes.number({ label: '行高(px)', defaultValue: 1 })
57 }, 49 },
58 componentsForPropsEditor: { 50 componentsForPropsEditor: {
59 'lbs-select-input-type': { 51 'lbs-select-input-type': {
front-end/h5/src/components/plugins/lbp-form-radio-group.js
@@ -2,13 +2,14 @@ @@ -2,13 +2,14 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-11-23 12:35:43 3 * @Date: 2019-11-23 12:35:43
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2019-11-23 19:50:57  
6 - * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-form-radio-group.js 5 + * @LastEditTime: 2020-05-17 23:17:23
  6 + * @FilePath: /h5/src/components/plugins/lbp-form-radio-group.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: 表单单选组组件 #!en: radio group component 8 * @Description: 表单单选组组件 #!en: radio group component
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
11 11
  12 +import PropTypes from '@luban-h5/plugin-common-props'
12 import LbpFormRadio from './lbp-form-radio.js' 13 import LbpFormRadio from './lbp-form-radio.js'
13 14
14 function getDefaultItems () { 15 function getDefaultItems () {
@@ -34,24 +35,14 @@ function getDefaultItems () { @@ -34,24 +35,14 @@ function getDefaultItems () {
34 export default { 35 export default {
35 name: 'lbp-form-radio-group', 36 name: 'lbp-form-radio-group',
36 props: { 37 props: {
37 - aliasName: {  
38 - type: String,  
39 - default: `标题演示`,  
40 - editor: {  
41 - type: 'a-input',  
42 - label: '填写标题',  
43 - require: true  
44 - }  
45 - },  
46 - items: {  
47 - type: Array,  
48 - default: () => getDefaultItems(),  
49 - editor: {  
50 - type: 'lbs-prop-text-enum-editor',  
51 - label: '选项列表',  
52 - require: true  
53 - }  
54 - }, 38 + aliasName: PropTypes.string({
  39 + defaultValue: `标题演示`,
  40 + label: '填写标题'
  41 + }),
  42 + items: PropTypes.textOptions({
  43 + label: '选项列表',
  44 + defaultValue: () => getDefaultItems()
  45 + }),
55 type: { 46 type: {
56 type: String, 47 type: String,
57 default: 'radio', 48 default: 'radio',
@@ -59,7 +50,7 @@ export default { @@ -59,7 +50,7 @@ export default {
59 type: 'a-radio-group', 50 type: 'a-radio-group',
60 label: '选择模式', 51 label: '选择模式',
61 require: true, 52 require: true,
62 - prop: { 53 + props: {
63 options: [ 54 options: [
64 { label: '单选', value: 'radio' }, 55 { label: '单选', value: 'radio' },
65 { label: '多选', value: 'checkbox' } 56 { label: '多选', value: 'checkbox' }
front-end/h5/src/components/plugins/lbp-form-radio.js
  1 +/*
  2 + * @Author: ly525
  3 + * @Date: 2020-05-17 19:54:20
  4 + * @LastEditors: ly525
  5 + * @LastEditTime: 2020-05-17 19:55:02
  6 + * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-form-radio.js
  7 + * @Github: https://github.com/ly525/luban-h5
  8 + * @Description: Do not edit
  9 + * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
  10 + */
1 import './styles/radio.scss' 11 import './styles/radio.scss'
2 // https://github.com/luban-h5-components/plugin-common-props 12 // https://github.com/luban-h5-components/plugin-common-props
3 -import commonProps from '@luban-h5/plugin-common-props'  
4 import { genUUID } from '../../utils/element.js' 13 import { genUUID } from '../../utils/element.js'
5 14
6 export default { 15 export default {
7 name: 'lbp-form-radio', 16 name: 'lbp-form-radio',
8 props: { 17 props: {
9 - ...commonProps,  
10 value: { 18 value: {
11 type: [String, Number], 19 type: [String, Number],
12 default: '选项值' 20 default: '选项值'
front-end/h5/src/components/plugins/lbp-notice-bar.js
@@ -2,34 +2,36 @@ @@ -2,34 +2,36 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2020-05-14 08:09:44 3 * @Date: 2020-05-14 08:09:44
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2020-05-14 08:36:35 5 + * @LastEditTime: 2020-05-17 21:18:32
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-notice-bar.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-notice-bar.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: Do not edit 8 * @Description: Do not edit
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
11 11
12 -import commonProps from '@luban-h5/plugin-common-props' 12 +import PropTypes from '@luban-h5/plugin-common-props'
13 import { NoticeBar } from 'vant' 13 import { NoticeBar } from 'vant'
14 import 'vant/lib/notice-bar/style' 14 import 'vant/lib/notice-bar/style'
15 15
16 export default { 16 export default {
17 name: 'lbp-notice-bar', 17 name: 'lbp-notice-bar',
18 props: { 18 props: {
19 - text: commonProps.text({ 19 + text: PropTypes.string({
20 defaultValue: '请填写内容,如果过长,将会在手机上滚动显示', 20 defaultValue: '请填写内容,如果过长,将会在手机上滚动显示',
21 - label: '公告' 21 + label: '公告',
  22 + props: {
  23 + type: 'textarea'
  24 + }
22 }), 25 }),
23 - vertical: commonProps.vertical,  
24 - backgroundColor: commonProps.backgroundColor,  
25 - color: commonProps.color, 26 + vertical: PropTypes.boolean(),
  27 + backgroundColor: PropTypes.color({ defaultValue: '#fffbe8' }), /** 淡黄色 */
26 mode: { 28 mode: {
27 type: String, 29 type: String,
28 default: '', 30 default: '',
29 editor: { 31 editor: {
30 type: 'a-select', 32 type: 'a-select',
31 label: '模式', 33 label: '模式',
32 - prop: { 34 + props: {
33 options: [ 35 options: [
34 { 36 {
35 label: '默认', 37 label: '默认',
front-end/h5/src/components/plugins/lbp-picture.js
  1 +import PropTypes from '@luban-h5/plugin-common-props'
  2 +
1 import placeholderImg from './lbp-picture-placeholder.png' // issue #34 3 import placeholderImg from './lbp-picture-placeholder.png' // issue #34
2 export default { 4 export default {
3 name: 'lbp-picture', 5 name: 'lbp-picture',
@@ -5,17 +7,7 @@ export default { @@ -5,17 +7,7 @@ export default {
5 return <img src={this.imgSrc || placeholderImg} alt="" srcset="" width="100%" /> 7 return <img src={this.imgSrc || placeholderImg} alt="" srcset="" width="100%" />
6 }, 8 },
7 props: { 9 props: {
8 - imgSrc: {  
9 - type: String,  
10 - default: placeholderImg,  
11 - editor: {  
12 - type: 'lbs-image-gallery',  
13 - label: '图片',  
14 - prop: {  
15 - type: 'textarea'  
16 - }  
17 - }  
18 - } 10 + imgSrc: PropTypes.image()
19 }, 11 },
20 data: () => ({ 12 data: () => ({
21 placeholderImg 13 placeholderImg
front-end/h5/src/components/plugins/lbp-slide.js
@@ -2,12 +2,13 @@ @@ -2,12 +2,13 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-11-23 12:35:21 3 * @Date: 2019-11-23 12:35:21
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2019-11-23 19:53:14 5 + * @LastEditTime: 2020-05-17 21:22:01
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-slide.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-slide.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: #!zh: 轮播图组件 #!en slide component 8 * @Description: #!zh: 轮播图组件 #!en slide component
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
  11 +import PropTypes from '@luban-h5/plugin-common-props'
11 12
12 import { Swipe, SwipeItem } from 'vant' 13 import { Swipe, SwipeItem } from 'vant'
13 import 'vant/lib/swipe/style' 14 import 'vant/lib/swipe/style'
@@ -29,19 +30,14 @@ function getDefaultItems () { @@ -29,19 +30,14 @@ function getDefaultItems () {
29 export default { 30 export default {
30 name: 'lbp-slide', 31 name: 'lbp-slide',
31 props: { 32 props: {
32 - interval: {  
33 - type: Number,  
34 - default: 4000,  
35 - editor: {  
36 - type: 'a-input-number',  
37 - label: '间隔时间',  
38 - require: true  
39 - }  
40 - },  
41 - editorMode: {  
42 - type: String,  
43 - default: 'preview'  
44 - }, 33 + interval: PropTypes.number({
  34 + defaultValue: 4000,
  35 + label: '间隔时间'
  36 + }),
  37 + editorMode: PropTypes.string({
  38 + defaultValue: 'preview',
  39 + label: '模式'
  40 + }),
45 activeIndex: { 41 activeIndex: {
46 type: Number, 42 type: Number,
47 default: 0, 43 default: 0,
front-end/h5/src/components/plugins/lbp-text.js
@@ -2,19 +2,19 @@ @@ -2,19 +2,19 @@
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-11-24 18:51:58 3 * @Date: 2019-11-24 18:51:58
4 * @LastEditors: ly525 4 * @LastEditors: ly525
5 - * @LastEditTime: 2020-04-25 11:14:38 5 + * @LastEditTime: 2020-05-17 21:11:10
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-text.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-text.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: luban-h5 text component/plugin 8 * @Description: luban-h5 text component/plugin
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
  11 +import PropTypes from '@luban-h5/plugin-common-props'
11 import { quillEditor } from 'vue-quill-editor' 12 import { quillEditor } from 'vue-quill-editor'
12 // require styles 13 // require styles
13 import 'quill/dist/quill.core.css' 14 import 'quill/dist/quill.core.css'
14 import 'quill/dist/quill.snow.css' 15 import 'quill/dist/quill.snow.css'
15 import './styles/text-overwrite-quil-snow-theme.scss' 16 import './styles/text-overwrite-quil-snow-theme.scss'
16 // https://github.com/luban-h5-components/plugin-common-props 17 // https://github.com/luban-h5-components/plugin-common-props
17 -import commonProps from '@luban-h5/plugin-common-props'  
18 18
19 export default { 19 export default {
20 render (h) { 20 render (h) {
@@ -87,14 +87,11 @@ export default { @@ -87,14 +87,11 @@ export default {
87 } 87 }
88 }, 88 },
89 props: { 89 props: {
90 - backgroundColor: commonProps.backgroundColor,  
91 - borderWidth: commonProps.borderWidth,  
92 - borderRadius: commonProps.borderRadius,  
93 - borderColor: commonProps.borderColor,  
94 - text: {  
95 - type: String,  
96 - default: '双击修改文字'  
97 - } 90 + backgroundColor: PropTypes.color({ label: '背景色' }),
  91 + borderWidth: PropTypes.number({ label: '边框宽度(px)' }),
  92 + borderRadius: PropTypes.number({ label: '圆角(px)' }),
  93 + borderColor: PropTypes.color({ label: '边框颜色' }),
  94 + text: PropTypes.string({ label: '双击修改文字' })
98 }, 95 },
99 editorConfig: { 96 editorConfig: {
100 } 97 }
front-end/h5/src/components/plugins/lbp-video.js
1 /* 1 /*
2 * @Author: ly525 2 * @Author: ly525
3 * @Date: 2019-12-01 18:11:50 3 * @Date: 2019-12-01 18:11:50
4 - * @LastEditors : ly525  
5 - * @LastEditTime : 2020-01-15 00:53:48 4 + * @LastEditors: ly525
  5 + * @LastEditTime: 2020-05-17 21:12:55
6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-video.js 6 * @FilePath: /luban-h5/front-end/h5/src/components/plugins/lbp-video.js
7 * @Github: https://github.com/ly525/luban-h5 7 * @Github: https://github.com/ly525/luban-h5
8 * @Description: Do not edit 8 * @Description: Do not edit
9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved 9 * @Copyright 2018 - 2019 luban-h5. All Rights Reserved
10 */ 10 */
  11 +import PropTypes from '@luban-h5/plugin-common-props'
  12 +
11 import playIcon from './play.svg' 13 import playIcon from './play.svg'
12 import './styles/video.scss' 14 import './styles/video.scss'
13 // 这里有个动画演示,可以用来学习 CSS:《CSS制作播放、暂停按钮》https://codepen.io/chriscoyier/full/lotjh 15 // 这里有个动画演示,可以用来学习 CSS:《CSS制作播放、暂停按钮》https://codepen.io/chriscoyier/full/lotjh
@@ -21,38 +23,24 @@ export default { @@ -21,38 +23,24 @@ export default {
21 editor: { 23 editor: {
22 type: 'lbs-video-gallery', 24 type: 'lbs-video-gallery',
23 label: '视频', 25 label: '视频',
24 - prop: { 26 + props: {
25 type: 'textarea' 27 type: 'textarea'
26 } 28 }
27 } 29 }
28 }, 30 },
29 - disabled: {  
30 - type: Boolean,  
31 - default: false  
32 - },  
33 - useIframe: {  
34 - type: Boolean,  
35 - default: false,  
36 - editor: {  
37 - type: 'a-switch',  
38 - label: '使用iframe'  
39 - }  
40 - },  
41 - iframeSrc: {  
42 - type: String, 31 + disabled: PropTypes.boolean({ label: 'disabled' }),
  32 + useIframe: PropTypes.boolean({ label: '使用iframe' }),
  33 + iframeSrc: PropTypes.string({
43 default: '', 34 default: '',
44 - editor: {  
45 - type: 'a-input',  
46 - label: 'iframe 地址',  
47 - prop: {  
48 - type: 'textarea',  
49 - placeholder: '只有使用iframe打开的时候,这个才有效'  
50 - },  
51 - extra: (h) => {  
52 - return '「使用iframe」打开的时候,这个才有效;上传视频请忽略该配置'  
53 - } 35 + label: 'iframe 地址',
  36 + props: {
  37 + type: 'textarea',
  38 + placeholder: '只有使用iframe打开的时候,这个才有效'
  39 + },
  40 + extra: (h) => {
  41 + return '「使用iframe」打开的时候,这个才有效;上传视频请忽略该配置'
54 } 42 }
55 - } 43 + })
56 }, 44 },
57 watch: { 45 watch: {
58 src () { 46 src () {
front-end/h5/yarn.lock
@@ -792,10 +792,10 @@ @@ -792,10 +792,10 @@
792 resolved "https://registry.yarnpkg.com/@luban-h5/plugin-common-props/-/plugin-common-props-0.0.1.tgz#10fe5d5b2dda1db64912b3b99779aec60b5ea956" 792 resolved "https://registry.yarnpkg.com/@luban-h5/plugin-common-props/-/plugin-common-props-0.0.1.tgz#10fe5d5b2dda1db64912b3b99779aec60b5ea956"
793 integrity sha512-D8UEBht2BCJt8YDHqcYj0hQmn3WM3QdX3Rw8eaZP02o0NeNe2oDPKE4mCM3eN9U1ygcrDf9bR48RB9YgHJRHGA== 793 integrity sha512-D8UEBht2BCJt8YDHqcYj0hQmn3WM3QdX3Rw8eaZP02o0NeNe2oDPKE4mCM3eN9U1ygcrDf9bR48RB9YgHJRHGA==
794 794
795 -"@luban-h5/plugin-common-props@^0.0.2":  
796 - version "0.0.2"  
797 - resolved "https://registry.yarnpkg.com/@luban-h5/plugin-common-props/-/plugin-common-props-0.0.2.tgz#17ac100c241fa16b4de7c259837a0af0862693ef"  
798 - integrity sha512-6lsjSq6nPYD1EdbIBugf3dDFAr55ijzyOH4gd6oor/rQ8o8qDlh4UH2L4zaXCUJnMgi8osF8mXnfLx4oBd0JMQ== 795 +"@luban-h5/plugin-common-props@^0.1.3":
  796 + version "0.1.3"
  797 + resolved "https://registry.yarnpkg.com/@luban-h5/plugin-common-props/-/plugin-common-props-0.1.3.tgz#90cf658d4805f345a93b552cae92124d0e9362b6"
  798 + integrity sha512-Ubihet2AIK1lW4USp8NtyrO5o0Vza8OtPBK4nlzF4jgdmW6qNrp6+hZbH2m3LAdF395Q/h1ZTtZZ2kS8IC5/cg==
799 799
800 "@mrmlnc/readdir-enhanced@^2.2.1": 800 "@mrmlnc/readdir-enhanced@^2.2.1":
801 version "2.2.1" 801 version "2.2.1"