正确写法1.
<th-form-item label="支付方式:">
<th-radio-group v-model="formData.paymentMethodCode" :disabled="originPayType === 5">
<th-radio :label="item.id" :disabled="params.feeStatus !== '未交'" v-for="(item, index) in payTypes" :key="index">{{item.name}}</th-radio>
</th-radio-group>
</th-form-item><br />
if(this.formType === 'franchiseFee') {
return [{
id:1,
name:'转账',},{
id:2,
name: '分期'},{
id:3,
name: '转账+分期'
},{
id:5,
name:'结算抵扣',
}
}],
}
写法2.
if(this.formType === 'franchiseFee') {
return [{'转账','分期','转账+分期','信贷','结算抵扣'}]
}
写法3.
if(this.formType === 'franchiseFee') {
return [{
id:1,
name:'转账',},{
id:2,
name: '分期'},{
id:3,
name: '转账+分期'
},{
id:4,
name: '信贷',
},{
id:5,
name:'结算抵扣',
}
}],
}
写法2.如果我们想隐藏掉信贷,但是不改变后面的index,我们可以用filter
<th-radio-group v-model="formData.paymentMethodCode" :disabled="originPayType === 5">
<th-radio :label="item.id" :disabled="params.feeStatus !== '未交'" v-for="(item, index) in payTypes" :key="index">{{item.name}}</th-radio>
</th-radio-group>
<th-form-item label="支付方式:">
<th-radio-group v-model="formData.paymentMethodCode" :disabled="originPayType === 5">
<th-radio :label="item.id" :disabled="params.feeStatus !== '未交'" v-for="(item, index) in payTypes.filter(items => items.name !== '信贷')" :key="items.id">{{items.name}}</th-radio>
</th-radio-group>
</th-form-item><br />