// 慢阻肺患者档案-服务档案 var template = ''; $.ajax('../../../component/statistics/CopdRecordSearch/index.html', { data: {}, dataType: 'html', cache: false, timeout: 60000, async: false, error: function (res) { }, success: function (res) { template = res; } }); Vue.component('copd-record-search', { template: template, props: [], data() { return { // 当前显示的字段 tableFieldList: [] }; }, methods: { toggleField(fieldName) { return this.tableFieldList.indexOf(fieldName) !== -1 } }, mounted() { var vm = this EventBus.$on('copd-record-filter-change', function (event) { vm.tableFieldList = event }) }, destroyed() { EventBus.$off('copd-record-filter-change'); } });