Commit bb26980df8372b73acd1bebfa584aa57a0a857d0
1 parent
5501cc6b
feat(plugin): add picture
Showing
2 changed files
with
41 additions
and
0 deletions
front-end/h5/src/components/plugins/lbp-picture.js
0 → 100644
| 1 | +const defaultPngPath = 'http://jietu-10024907.file.myqcloud.com/kblthjeuhituluuaalpiuyvfwrldpkrj.jpg' | ||
| 2 | + | ||
| 3 | +export default { | ||
| 4 | + name: 'lbp-picture', | ||
| 5 | + render () { | ||
| 6 | + return <img src={this.imgSrc || defaultPngPath} alt="" srcset="" width="100%" /> | ||
| 7 | + }, | ||
| 8 | + props: { | ||
| 9 | + imgSrc: { | ||
| 10 | + type: String, | ||
| 11 | + default: defaultPngPath | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + data: () => ({ | ||
| 15 | + defaultPngPath | ||
| 16 | + }), | ||
| 17 | + editorConfig: { | ||
| 18 | + propsConfig: { | ||
| 19 | + imgSrc: { | ||
| 20 | + type: 'picture-picker', | ||
| 21 | + label: '', | ||
| 22 | + require: true, | ||
| 23 | + widgetProps: { | ||
| 24 | + value: '', | ||
| 25 | + template: '%i', | ||
| 26 | + }, | ||
| 27 | + }, | ||
| 28 | + }, | ||
| 29 | + components: { | ||
| 30 | + // 'picture-picker': PicturePicker, | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | +} |
front-end/h5/src/views/Editor.vue
| @@ -3,6 +3,7 @@ import Vue from 'vue' | @@ -3,6 +3,7 @@ import Vue from 'vue' | ||
| 3 | import CoreEditor from '../components/core/editor' | 3 | import CoreEditor from '../components/core/editor' |
| 4 | 4 | ||
| 5 | import LbpButton from '../components/plugins/lbp-button' | 5 | import LbpButton from '../components/plugins/lbp-button' |
| 6 | +import LbpPicture from '../components/plugins/lbp-picture' | ||
| 6 | 7 | ||
| 7 | const PluginList = [ | 8 | const PluginList = [ |
| 8 | { | 9 | { |
| @@ -11,6 +12,13 @@ const PluginList = [ | @@ -11,6 +12,13 @@ const PluginList = [ | ||
| 11 | component: LbpButton, | 12 | component: LbpButton, |
| 12 | visible: true, | 13 | visible: true, |
| 13 | name: 'lbp-button' | 14 | name: 'lbp-button' |
| 15 | + }, | ||
| 16 | + { | ||
| 17 | + title: '图片', | ||
| 18 | + icon: 'file-image-o', | ||
| 19 | + component: LbpPicture, | ||
| 20 | + visible: true, | ||
| 21 | + name: 'lbp-picture' | ||
| 14 | } | 22 | } |
| 15 | ] | 23 | ] |
| 16 | 24 |