function _getProductType (arr, num, str) {
let type = ""
arr.forEach(val => {
if (num == val.code_val) { //eslint-disable-line
type = val.code_desc
} else if (num == "1000") { //eslint-disable-line
type = ""
}
})
return type + "" + (str || "")
}
export async function productType (num, str) {
let productTypes = []
function aaa () {
return getByCode(52).then(res => {
if (res.data.success) {
productTypes = res.data.data
return _getProductType(productTypes, num, str)
}
})
}
let b = await aaa()
return b
}
productType is a filter for vue, but returns promise, but the label attribute in template accepts only string types.
how to deal with this situation (axios is also owned by promise.)