How do i update element properties by plugin in builder #142
Unanswered
Tim-Wapenaar-Fenetre
asked this question in
Questions
Replies: 1 comment
-
Unfortunately that's not going to work, because modifying properties like this at runtime is possible (and advised) in Vue. Instead, you can define a preset for the builder, that overrides the default values for file type elements. Here's a working demo. // file.preset.js
import { elementTypes } from '@vueform/builder';
export default {
element: {
types: {
file: {
...elementTypes.file,
schema: {
...elementTypes.file.schema,
accept: 'image/*,audio/*',
// accept: 'application/gzip,application/json',
// accept: '.aac,.abw',
},
},
},
},
} <!-- App.vue -->
<script setup>
import { ref, onMounted } from 'vue';
import filePreset from './file.preset';
</script>
<template>
<div id="app" class="h-screen">
<VueformBuilder :config="{ preset: filePreset }" />
</div>
</template>
<style></style> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im passing some settings to the builder component which I want to use as default for elements. I would guess a good place for that would be by a plugin.
In the next example, i want to set the
accept
property of the fileElement with my list of allowed file type.But this does not update those properties.
And trying to set the value with
props.accept.value = formSettings.allowedFileTypes
results in acannot set a readonly property
warningBeta Was this translation helpful? Give feedback.
All reactions