【发布时间】:2018-09-19 06:13:58
【问题描述】:
我有 2 个选择字段:
第一个字段:
ns-dropdown-item(item-id="6")
ns-select(:placeholder="$t('users.role')", v-model="newLeader.role",
:options="roleOptions", @change="activeIfCoororMan")
第二个字段被禁用
ns-dropdown-item(item-id="7")
ns-select(:placeholder="$t('users.client')", v-model="client",
:options="clients", :disabled="true")
这是我的 vue 数据:
export default {
template: template(),
data() {
return {
newLeader: null,
client: null,
clients: [],
errors: {},
roleOptions: [
{value: 'coordinator', label: this.$t('users.roleOptions.coordinator')},
{value: 'manager', label: this.$t('users.roleOptions.manager')},
{value: 'leader', label: this.$t('users.roleOptions.leader')},
{value: 'leader_admin', label: this.$t('users.roleOptions.leader_admin')}
]
};
},
methods: {
activeIfCoororMan() {
if(this.newLeader.role === 'manager' || this.newLeader.role === 'coordinator') {
console.log("remove-disabled")
} else {
console.log("stay-disabled")
}
},
}
}
当我首先选择 coordinator 或 manager 时,我可以在控制台中看到:remove-disable。但是,我想将 :disable 属性从第二个字段更改为 false。
谢谢
【问题讨论】:
标签: javascript vue.js vuejs2 vue-component