全局修改覆盖element-plus组件的默认属性?

1、vue3中如何全局修改覆盖掉element-plus组件的默认属性?
2、全局修改element-plus ElInput组件的clearable属性为true,会影响到基于ElInput组件封装的其他组件的clearable属性,比如ElSelect、ElPagination组件,会导致ElPagination组件出现以下的情况。
图片.png

阅读 2.4k
1 个回答
// 这里已修改ElSelect为示例
import ElementPlus, { ElSelect } from 'element-plus'

ElSelect.props.clearable= {
  type: Boolean,
  default: true
}




 
// 注册全局组件
app.component('Pagination', Pagination)
    .use(createPinia())
    .use(router)
    .use(Dictionary)
    .use(ElementPlus, { locale })
    .use(i18n)
    .use(VXETable)
    .component('QtTable', QtTable)
    .mount('#app')
// 全局设置表格斑马纹 
const ElementComponents = app._context.components;
ElementComponents.ElTable.props.stripe = { type: Boolean, default: true };



撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题