Reputation: 25928
I have a component called Card.vue
that is duplicated many times. So there is not one instance of the component. Should I still be using el
to link the element with the component? Ie should I be doing the following or something else?
<template>
<div class="card">
...
</div>
</template>
<script>
export default {
el: '.card', // should I use another property (list?) or something else?
}
</script>
<style lang="scss">
</style>
Upvotes: 0
Views: 1043
Reputation: 43881
el
is used for a top-level Vue instance to indicate where the instance should be inserted.
You should not generally be providing an el
to components. They are typically inserted using custom tags within a parent's template. See the docs for some examples as well as general information.
A parent object using your component might have code like
<Card></Card>
to insert the component. Although you should really use a safe custom tag (primarily meaning it should have a hyphen) for your component.
Upvotes: 1