How to prefill data in vue form?

Solution for How to prefill data in vue form?
is Given Below:

I am using vue form to edit one item, but I cannot conclude in which method should I assign a values to categoryName and description to make those values ​​appear in form?

I tried to make axios call and assign response to categoryName and description in the methods: created, mounted, beforeMouned, but it does not show values of categoryName and description in input fields, although values are obtained from the backend. Also v-model.lazy does not give results.

This is my code:

  <div class="pt-5">
    <form @submit.prevent="submitCategory">
      <div class="form-group">
        <label for="categoryName">Category name</label>
        <input v-model.lazy="categoryName" value="categoryName" type="text" class="form-control" id="categoryName" aria-describedby="categoryNameHelp" placeholder="Enter category name">
      <div class="form-group">
        <label for="description">Description</label>
        <input v-model="description" type="text" class="form-control" id="description" placeholder="Enter description">
      <button type="submit" class="btn btn-primary mt-2">Submit</button>

export default {
  name: "EditCategory",
  data() {
    return {
      categoryName: '',
      description: '',
  beforeMount () {
        id: this.$
      }).then((response) => {
      this.categoryName = response.categoryName;
      this.description = response.description;
    });    },
  methods: {
    submitCategory() {
      this.$'/api/categories', {
        categoryName: this.categoryName,
        description: this.description,
      }).then(response => {
        this.$router.push({name: 'Categories'});
    initialize () {


<style scoped>


Axios Response object

When we send a request to a server, it returns a response. The Axios response object consists of:

  1. data – the payload returned from the server
  2. status – the HTTP code returned from the server
  3. headers – headers sent by server

You did console.log( in BeforeMount Hook. You will get your required data under object

this.categoryName =;
this.description =;