angular js 之组件封装篇

1 table-group组件:

<label class="btnBar" style="position: relative ;" ng-if="$ctrl.exportBtn">
    <button class="btn btn-warning" style="margin-top:-10px;margin-bottom: 6px" ng-click="$ctrl.exportSum()"><span
            class="glyphicon glyphicon-cloud-download" style="right: 4px"></span>导出
    </button>
</label>
ctrl=this;
ctrl.exportSum=function () {
    ctrl.onExport({deviceNo: deviceNo});
}
bindings: {
    exportBtn:'<',  // 代表输入属性
    onDetail: '&',  // 代表输出属性
    onExport: '&',
}

2 其他组件

<table-group
        export-btn="true"
        on-export="$ctrl.export(deviceNo)"
></table-group>
var vm = this;
vm.export = function (params) {
 
    console.log("---------导出", params);
}

猜你喜欢

转载自blog.csdn.net/qq_38643776/article/details/82837757