1234567891011121314151617181920212223242526272829303132333435 |
- <template>
- <uv-form-item ref="formItem" v-bind="$attrs" :id="idPrefix+$attrs.prop">
- <template v-for="(_, name) in $slots" #[name]>
- <slot :name="name"/>
- </template>
- </uv-form-item>
- </template>
- <script>
- // NOTE: 如果直接用extends继承,样式无法继承,所以改用这个形式做props穿透和事件穿透
- // 这样做的缺陷就是使用时的提示不够明显
- export default {
- name: "ai-form-item",
- inject: ['getIdPrefix'],
- provide() {
- return {
- getFormItem: () => this.$refs.formItem
- }
- },
- computed: {
- idPrefix() {
- // noinspection JSUnresolvedFunction
- return this.getIdPrefix()
- }
- }
- }
- </script>
- <style scoped>
- ::v-deep .uv-form-item__body__right__message {
- text-align: right;
- margin-right: 10px;
- }
- </style>
|