/**
* 得到结果
* @param {string} key 查找关键字以;分割
* @return {array} 所有可选属性数组
*/
getResult(key, isRealFind = true) {
// 如缓存中存在,则直接返回结果
if (this.cacheData[key] && isRealFind) {
this.result = this.cacheData[key];
this.resultID = this.goodsDict[key] ? this.goodsDict[key] : '';
console.log(this.resultID);
return this.result;
}
// 继续查找
let result = '';
for (let _key in this.goodsDict) {
let keyArr = key.split(';');
let _keyArr = _key.split(';');
let arr = keyArr.concat(_keyArr);
arr = Array.from(new Set(arr));
if (arr.length === _keyArr.length) {
result += _key;
}
}
if (isRealFind) {
// 所有可选属性
this.result = result.split(';');
let _keyArr = key.split(';');
if (_keyArr[_keyArr.length - 1] === '') {
_keyArr.pop();
}
for (let i = 0; i < _keyArr.length; i++) {
let _arr = key.split(';');
let str = _arr.splice(i, 1);
let oldResult = this.getResult(_arr.join(';'), false);
let index = '';
// 获取该key所在索引
this.allKeys.forEach((item, i) => {
if (item.indexOf(str.join('')) !== -1) {
index = i;
return;
}
});
this.allKeys[index].forEach(item => {
if (oldResult.indexOf(item) !== -1) {
this.result.push(item);
}
});
}
this.result = Array.from(new Set(this.result));
// 缓存数据
this.cacheData[key] = this.result;
this.resultID = this.goodsDict[key] ? this.goodsDict[key] : '';
console.log(this.resultID);
return this.result;
} else {
return result;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有