Commit 7b6a433febe6c58e6d0fb8cb73b80dc778b177d8

Authored by ly525
1 parent 22ab4bc4

chore(plugin): add comment to explain how plugin prop editor run(增加对插件的属性编辑器运行原理的注释)

front-end/h5/src/components/plugins/lbp-button.js
@@ -164,6 +164,28 @@ export default { @@ -164,6 +164,28 @@ export default {
164 defaultPropValue: 1 164 defaultPropValue: 1
165 }, 165 },
166 textAlign: { 166 textAlign: {
  167 + /**
  168 + * #!en: you can also config type like below:
  169 + * #!zh: 可以直接这样写:
  170 + textAlign: {
  171 + type: component(component definition json/自定义的组件,比如下面的 components[''lbs-text-align'])
  172 + }
  173 +
  174 + * more explanation
  175 + textAlign: {
  176 + type: {
  177 + render() {},
  178 + props: {},
  179 + methods: {},
  180 + }
  181 + }
  182 + * #!en: reference: how to judge the tag is custom component or a HTML element in React or Vue?
  183 + * !#zh:
  184 + * 思路来源:
  185 + * React 中 深入JSX 中,如何判断 h(tag) 中的 tag 是自定义组件还是普通 HTML 元素呢?React 是判断该 tag 是否为 function 来实现的
  186 + * Vue 中的自定义组件 是一个普通的 JSON 对象,最后自定义组件被转换成了函数,输入是 JSON 输出是 函数,可以看看 Vue 中 createElement 也就是 h 的实现·
  187 + * 参见:http://hcysun.me/2018/01/05/%E6%8E%A2%E7%B4%A2Vue%E9%AB%98%E9%98%B6%E7%BB%84%E4%BB%B6/
  188 + */
167 type: 'lbs-text-align', 189 type: 'lbs-text-align',
168 label: '文字对齐', 190 label: '文字对齐',
169 require: true, 191 require: true,