form-create icon indicating copy to clipboard operation
form-create copied to clipboard

自定义的组件无法使用$attrs透传

Open zjjjjjjjjjjd opened this issue 3 years ago • 1 comments

"@form-create/ant-design-vue": "2.5.10",

"ant-design-vue": "1.7.8",

自定义的组件无法使用$attrs透传

{
            type: 'ExtraInput',
            required: true,
            title: '名称',
            field: 'name',
            props: {
                placeholder: '请输入',
                extra: '没有',
                extraBtn: '立即',
                onExtraBtn: () => {
                    console.log('44444')
                }
            },
            wrapperCol: { span: 14 }
        },
<div class="extra-input-wrap">
        <a-input v-bind="$attrs" v-on="$listeners" />
        <!-- <slot name="extra" /> -->
        <span v-if="extra" class="extra">
            {{ extra }}
            <a-button type="link" @click="onExtraBtn">{{ extraBtn }}</a-button>
        </span>
    </div>


export default {
    props: {
        extra: {
            type: String,
            default: ''
        },
        extraBtn: {
            type: String,
            default: ''
        },
        onExtraBtn: {
            type: Function,
            default: () => {}
        }
    },

placeholder 没能在 $attrs 中传递

但是,我从props中定义了就能拿到

正常使用就好

zjjjjjjjjjjd avatar Aug 26 '22 01:08 zjjjjjjjjjjd

感谢反馈

xaboy avatar Aug 29 '22 01:08 xaboy