You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vue项目遇TS2339错误:类型'{ submit(): Promise<void>; }'无last_name属性

Vue项目TS类型错误问题

前端领域新手,在Vue项目中编写了如下代码,期望从.vue文件中获取first_name、last_name等数据,通过axios提交到指定URL,但出现错误提示:

TS2339:Property 'last_name' does not exist on type '{ submit(): Promise; }'

代码示例

export default {
  name: "Register",
  data() {
    return {
      first_name: '',
      last_name: '',
      email: '',
      password: '',
      password_confirm: '',
    }
  },
  methods: {
    async submit() {
      await axios.post('addr', {
        first_name: this.first_name,
        last_name: this.last_name,
        email: this.email,
        password: this.password,
        password_confirm: this.password_confirm,
      });
      await this.$router.push('/login');
    }
  }
}

错误提示截图

错误提示截图

内容的提问来源于stack exchange,提问作者amirpny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 16:32:04