J
J
jazzus2020-02-28 10:48:21
Vue.js
jazzus, 2020-02-28 10:48:21

How to exclude props from the list?

Props are thrown from one component to another

<component v-bind="$props">
</component>

Is it possible to exclude some props? like $props without 'name'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2020-02-28
@jazzus

<component v-bind="props"></component>

computed: {
    props () {
        const {ненужный_проп, ...props} = this.$props;
        return props;
    }
}

A
Andrey Suha, 2020-02-28
@andreysuha

You need to immediately transfer only those props that are needed if you need age and male, then you only transfer them

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question