SOURCE

const type = '002'
const busNum = 'a180980909'

const paramKey = type === '000' ? 'cId' : 'bId'
const param = {
    [paramKey]: busNum
}
console.log(param)

const paramKeys = {
    '000': 'cId',
    '001': 'bId',
    '002': 'dId',
}
const queryData = {
    [paramKeys[type]]: busNum,
}

console.log(queryData)

const props = {
    name: 'xioaming',
    work: ['jianpan', 'demo']
}

const paramK = props.name || props.work[0]
const qData = {
    [paramK]: busNum
}
console.log(qData)
console 命令行工具 X clear

                    
>
console