组件化

组件的按钮例子改为store版本

<div class="bui-btn" b-class="btn.color" b-text="btn.text" b-click="btn.submit">按钮</div>
loader.define(function(requires,exports,module,global){

    // 接收外部参数
    let props = module.props;

    var bs = bui.store({
        el: `#${module.id}`,
        scope: 'btn',
        data: {
            text: props.text || "",
            color: props.color || "",
        },
        mounted(){
            // 加载完成后初始化
        },
        methods: {
        submit(e){
            bui.alert("绑定点击事件")
        }
        }
    })

    return bs;
})

使用

<component name="pages/components/btn" color="primary"></component>
Copyright ©2017-2022 easybui.com all right reserved,powered by Gitbook该文件修订时间: 2022-01-06 16:26:56

results matching ""

    No results matching ""