booleen
booleen
  • 发布:2025-02-28 11:23
  • 更新:2025-02-28 11:23
  • 阅读:12

vue模板无法访问字符串

分类:uni-app x

<com-input class='com-input-grey-bg' placeholder="you@email.com"
v-model="data.account as string" clearable></com-input>

io.dcloud.uniapp.vue.UTSReactiveJSONObject cannot be cast to uni.UNIC2451D5.GenPagesLogin$Companion$setup$1$Info‌

报错地方:

v-model="data.account as string"

这怎么解决

申明对象

type InfoBase = {
account : string;
password : string;
}

class Info extends UTSJSONObject {
account : string = "";
password : string = "";
constructor(obj : InfoBase) {
this.account = obj.account;
this.password = obj.password;
// return {
// account:this.account,
// password:this.password
// }
}
}

const data = ref<Info>(new Info({  
    account: "", //123@qq.com  
    password: "" //12345678  
} as InfoBase));  
2025-02-28 11:23 负责人:无 分享
已邀请:

要回复问题请先登录注册