ndtypeList: [], brandtypeList: [], }, mounted: function() { const brandtypeList = this.ptList.reduce(function (total, item) { item.btList.forEach(function(bt) { bt.parentId = item.id; total.push(bt); }) return total; }, []); this.originBrandtypeList = brandtypeList || []; this.brandtypeList = brandtypeList || []; }, methods: { filterBrandtype: function () { if (!headerApp.isBrandtypeSearch && headerApp.brandtypeName) { headerApp.isBrandtypeSearch = true; } headerApp.brandtypeList = headerApp.originBrandtypeList.filter(function(item) { return (item.name.indexOf(headerApp.brandtypeName) !== -1) || (item.shortName.indexOf(headerApp.brandtypeName) !== -1); }); }, }, }).$mount('#header'); }, 1000);