小编yrb*_*bet的帖子

传递复选框 true 或 false VueJS

我的 VueJS 网站上有一个复选框,我想执行以下操作:如果该复选框special为 true,则在列中发送数据库值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
        }));
      });
    },
Run Code Online (Sandbox Code Playgroud)

在后端,当我在表中添加数据时,我使用$special = $r->get('special');,但它不想工作。我什么时候犯错了?

vue.js

3
推荐指数
1
解决办法
9582
查看次数

标签 统计

vue.js ×1