1
0
mirror of synced 2025-02-16 20:53:13 +03:00
vue-formulario/src/FormularioFieldGroup.vue
2021-06-14 14:02:10 +03:00

39 lines
778 B
Vue

<template>
<div>
<slot />
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import {
Component,
Inject,
Prop,
Provide,
} from 'vue-property-decorator'
@Component({ name: 'FormularioFieldGroup' })
export default class FormularioFieldGroup extends Vue {
@Inject({ default: '' }) __Formulario_path!: string
@Prop({ required: true })
readonly name!: string
@Provide('__Formulario_path')
get fullPath (): string {
const path = `${this.name}`
if (parseInt(path).toString() === path) {
return `${this.__Formulario_path}[${path}]`
}
if (this.__Formulario_path === '') {
return path
}
return `${this.__Formulario_path}.${path}`
}
}
</script>