第一次提交
This commit is contained in:
29
components/init-logistics.js
Normal file
29
components/init-logistics.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import Vue from 'vue';
|
||||
export const setAttribute = function(data) {
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
return data.map((item, index) => {
|
||||
Vue.set(item, 'isFirstNode', false)
|
||||
return item
|
||||
})
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export const changeAttribute = function(testStrList, targetList) {
|
||||
let cacheData = targetList;
|
||||
testStrList.forEach((item, index) => {
|
||||
let result_Index = targetList.findIndex(function(f_item, f_index) {
|
||||
return String(f_item.status) == item
|
||||
})
|
||||
if (result_Index != -1) {
|
||||
cacheData[result_Index].isFirstNode = true;
|
||||
}
|
||||
})
|
||||
return cacheData;
|
||||
}
|
||||
|
||||
export default {
|
||||
setAttribute,
|
||||
changeAttribute
|
||||
}
|
||||
Reference in New Issue
Block a user