Pass data from parent to child in Vue

07 February 2022 JavaScript Web Development Vue

Parent template - component

<wCar
  v-for="(car, index) in filterCars"
  :index="index"
  :key="car.id"
  :car="car"
  :wicon="wSVG"
/>

Parent script

  methods: {
    async hideCars(car) {
        this.wSVG = car.icon_path;
    }
  },

Child template - component

<h3>{ wicon }</h3>

Child script

  props: {
    car: [Object, String],
    wicon: String,
    index: Number
  },

Source link: source-link