我的 Vuetify Switch 没有改变他的价值? [英] My Vuetify Switch not change his value?

查看:36
本文介绍了我的 Vuetify Switch 没有改变他的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 vuetify 开关,它应该从 API True 或 False 接收值.

I have a vuetify switch that should receive value from the API True or False.

API 返回 True,但 Switch 始终显示 False.

The API returns True, but the Switch always shows False.

<v-switch label="Habilitado">{{props.item.habilitado}}</v-switch>

开关位于带有其他值的 vuetify 数据表中.其他值接收数据,但似乎开关没有.

The switch is inside an a vuetify data table with others values. The other values receive data, but seems the switch not.

我在 data() 中的项目返回:

My items in data() return:

   items:[{
    habilitado: "",
}],

在 Postman 中显示 True 值

In Postman shows True the value

我的 axios 获取方法:

My axios Get Method:

    cargarTanques(){
    axios
  .get("http://localhost:58209/api/Tanque/GetTanques", {
    headers: {
      Authorization: "Bearer " + localStorage.getItem("token")
    }
  })
  .then(response => {
    console.log(response);
    this.items = response.data;
    //this.snackbar = true;
    //this.textSnackbar = "Se han cargado correctamente las estaciones";
  })
  .catch(error => {
    console.log(error.response);
    this.snackbar = true;
    this.textSnackbar =
      "Lo sentimos, no pudimos cargar la información de los tanques";
  });
},

谢谢

编辑

接收值的类有:public bool Habilitado {get;设置;}

The class which receives the value has: public bool Habilitado {get; set;}

推荐答案

我遇到了同样的问题,这是因为我的应用程序不在 v-app 标签内.

I had this same issue and it was because my app was not inside a v-app tag.

v-menu 的 Vuetify 问题

这篇关于我的 Vuetify Switch 没有改变他的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆