problems on creating own components

  • I’d tried to make a component from this “q-popup-edit” section below (cause I’ll need them more than once):
    But after hours of trial&error still without any success.
    So my question is: Will this be somehow possible and how?

      v-for="col in props.cols"
     {{ col.value }}
      v-if="['Mail1', 'Mail2'].includes("
      @input="v => (vm[] = v)"
      @save="(v, i) => updateCell(v, i, props.row,"
      @before-show="() => cpRow(props.row)"
            :rules="[ val => !!val || $t('txtRequired'),isValidEmail ]"

    The methods “validateMail” and “isValidEmail” are yet located in the component file.
    But “updateCell” and “cpRow” are methods used in the vue file in which i want to use the component.
    ( vm returns only this pointer )

    Where I got problems in how to get the v-model set in the component, so that i’ll be able to use
    somewhere “this.$emit()” somehow and furtheron on how to treat with the event callbacks @save and @before-show ?

    Any suggestions? Thx.

  • You are on the right track with this.$emit(). You need to create methods that fire the this.$emit() method so you can “pass” information up to the parent. In other words, instead of inline methods, create methods which will do the communicating up to the parent component with this.$emit(). Those emits (as you build them) become the events available to use on the parent. Props down - events up.


Log in to reply