首页 > 解决方案 > 我错过了什么吗,this.form.fill() 似乎对我不起作用

问题描述

我的用户控制器功能:

public function profile()
{
    return auth('api')->user();
}

我正在开发带有 vue 的前端和带有 laravel 的后端的项目。

我的 Vue.js 代码:

 import Form from 'vform';
  export default {

   data () {
    return {
      form: new Form({
        id:'',
        name: '',
        email: '',
        password: '',
        type:'',
        bio:'',
        photo:''
      })
    }
  },

    mounted() {
        console.log('Component mounted.')
    },

    created(){
        axios.get("api/profile")
         .then( ({data}) => (this.form.fill(data)))
    }

 }

我尝试以表格形式显示数据,但是当我调用此函数时,它不会返回数据。我做错了什么?我知道这个函数 this.form.fill(data) 有问题,但我不知道实际的问题是什么。

标签: laravelvue.js

解决方案


推荐阅读