<!--
 * @Descripttion:
 * @Version: 1.0
 * @Author: +C
 * @Date: 2022-02-15 08:47:06
 * @LastEditors: wufz
 * @LastEditTime: 2022-06-15 09:47:54
-->
<script>
import formComponents from "./formComponents"
export default {
  name: `DxxButton`,
  //继承表单父组件
  extends: formComponents,
  inheritAttrs: false,
  // functional: true, //函数式组件
  props: {
    htmlType: {
      type: String,
      required: false,
      default: 'button'
    },
    type: {
      type: String,
      required: false,
      default: 'default'
    }
  },
  //建立虚拟 DOM
  render: function (createElement) {

    //编辑：dom表单元素
    let drawFromComponents = createElement(
      // 标签名称
      `a-button`,
      // 传递数据
      {
        attrs: {
          ...this.$attrs
        },
        props: {
          ...this._props
        },
        on: {
          ...this.$listeners
        }
        /* ...context.data,
        props: {
          ...context.props
        },
        class: (context.data.staticClass || "") + "", //自定义class
        style: {
          ...context.data.staticStyle
        } */
      },
      // 子节点数组，createElement...
      [
        this.$slots.default
      ]
    );

    return drawFromComponents;
  }
};
</script>

<style scoped>
</style>