【发布时间】:2021-05-02 12:47:32
【问题描述】:
我的 VueJS 网站上有一个复选框,我想要执行以下操作:如果复选框 special 为真,则在列中发送数据库值 1,我该如何正确执行此操作?
我是这样做的:
<label class="checkbox-control">
<input type="checkbox" v-model="special" v-on:change="special" :disabled="channel.length === 0">
<div class="checkbox-control__content"><i></i>Test</div>
</label>
data() {
return {
channel: "",
special: false,
}
sendFunction() {
this.$root.axios.post("/user/userPromo", {
channel: this.channel,
special: this.special
}).then((res) => {
const data = res.data;
this.$root.showNotify(data.type, this.$t(`index.${data.message}`, {
name: data.name
}));
});
},
在后端,当我在表中添加数据时,我使用$special = $r->get('special');,但它不想工作。我的错误是什么时候?
【问题讨论】:
标签: vue.js