【发布时间】:2020-11-04 17:39:54
【问题描述】:
您好,我正在尝试在方法函数中调用计算函数。
VueJs 代码:
<script>
export default {
created() {
this.isDisabled(0);
},
data: function() {
return {
form: {
branch_office_id: null,
cashier_id: null,
gross_amount: '',
released_tickets: '',
start_ticket: '',
end_ticket: '',
z_inform_number: '',
created_at: '',
support: null,
error_end_bill_number_validation: ''
},
postsSelected: "",
branch_office_posts: [],
cashier_posts: []
}
},
methods: {
checkEndBillNumber() {
if(this.form.start_ticket > this.form.end_ticket) {
this.isDisabled(1);
this.$awn.alert("El número de boleta inicial no puede ser ", {labels: {success: "Error"}});
} else {
this.isDisabled(0);
}
}
},
computed: {
isDisabled(value) {
if(value == 0) {
return true;
} else {
return false;
}
}
}
}
</script>
我正在尝试在 checkEndBillNumber() 方法函数中使用 isDisabled() 函数,但是当我这样做时它说:
[Vue 警告]:v-on 处理程序中的错误:“TypeError:this.isDisabled 不是函数”
所以我想知道如何使用它?我怎样才能做到这一点?谢谢!
【问题讨论】:
-
你不能在计算函数中传递参数。