1234567891011121314151617181920212223242526 |
- Vue.component('tab-customfields', {
- props: ['saved', 'errors', 'formdata', 'schema'],
- template: '<section><form>' +
- '<component v-for="(field, index) in schema.fields"' +
- ':key="index"' +
- ':is="selectComponent(field)"' +
- ':errors="errors"' +
- ':name="index"' +
- 'v-model="formdata[index]"' +
- 'v-bind="field">' +
- '</component>' +
- '<div v-if="saved" class="metaLarge"><div class="metaSuccess">Saved successfully</div></div>' +
- '<div v-if="errors" class="metaLarge"><div class="metaErrors">Please correct the errors above</div></div>' +
- '<div class="large"><input type="submit" @click.prevent="saveInput" value="save"></input></div>' +
- '</form></section>',
- methods: {
- selectComponent: function(field)
- {
- return 'component-'+field.type;
- },
- saveInput: function()
- {
- this.$emit('saveform');
- },
- }
- })
|