blitzar icon indicating copy to clipboard operation
blitzar copied to clipboard

Use VueUse composable useVModel to update all props

Open abbjetmus opened this issue 3 years ago • 0 comments

Hi! Thank you for the work put in Blitzar.

I'm using Blitzar to create a dynamic form creator where user selects form-components and then modify properties on the form components. Change schema values. I would like to use VueUse composable to achieve this change props and then updating through emits the schema and not just form data. Is this possible could you give some hints best way to change schema from component? here is an example only works for formData modeValue but not schema props:

<template>
  <q-input
        ref="input"
        type="text"
        outlined
        :required="required"
        :readonly="readonly"
        :label="text"
        v-model="modelValue"
    />
</template>
<script setup>

import { ref } from 'vue';
import { useVModel } from '@vueuse/core';

const emits = defineEmits([
  'update:modelValue',
  'update:required',
  'update:text',
]);
const props = defineProps([
  'modelValue',
  'name',
  'placeholder',
  'text',
  'required',
  'readonly',
]);

const modelValue = useVModel(props, 'modelValue', emits);
const required = useVModel(props, 'required', emits);
const text = useVModel(props, 'text', emits);

abbjetmus avatar Nov 14 '22 21:11 abbjetmus