[Vuejs]-Vue2 – attribute binding in components

0👍

  1. If you are saying "how can I pass an orderBy value to the ordering-filters instance", then you are looking for props.

    props: {
    orderBy: {
    type: String,
    required: true
    }
    }

Then

<ordering-filters :order-by="someStringVal"></ordering-filters>
  1. For your second question, you don’t necessarily need isActive.

    <a href="#" :class="{‘active’ : order === ‘asc’}"
    @click="orderCountries({orderBy, order: ‘asc’})">
    <a href="#" :class="{‘active’ : order === ‘desc’}"
    @click="orderCountries({orderBy, order: ‘desc’})">

    methods: {
    orderCountries(params){
    this.order = params.order
    }
    }

Leave a comment