[Vuejs]-How to extend the behaviour of components in Vue

0๐Ÿ‘

โœ…

Iโ€™m not able to test this now, but I believe $attrs and $listeners should do what you want to achieve or at least point you in the right direction:

<template>
  <el-form v-bind="$attrs" v-on="$listeners" :label-position="labelPosition">
    <slot />
  </el-form>
</template>

0๐Ÿ‘

You made a mistake in passing props like below:

<el-form v-bind="formProps" label-position=":labelPosition">
    <slot />
</el-form>

In the above codes, label-position=":labelPosition" is wrong.

It should be:label-position="labelPosition", so;

<el-form v-bind="formProps" :label-position="labelPosition">
    <slot />
</el-form>

Leave a comment