From 0b2fdeaa21474e9bddcfb81c554d1bbe4f53b054 Mon Sep 17 00:00:00 2001 From: zkwolf Date: Fri, 25 Dec 2020 00:31:38 +0800 Subject: [PATCH] chore: remove all hard code component name --- components/select/index.tsx | 4 ++-- components/tree-select/index.tsx | 2 +- components/vc-select/OptGroup.tsx | 1 + components/vc-select/Option.tsx | 1 + components/vc-tree-select/src/SelectNode.jsx | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/select/index.tsx b/components/select/index.tsx index 69981659ea..3d4393a8a8 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -225,8 +225,8 @@ const Select = defineComponent({ /* istanbul ignore next */ Select.install = function(app: App) { app.component(Select.name, Select); - app.component('ASelectOption', Select.Option); - app.component('ASelectOptGroup', Select.OptGroup); + app.component(Select.Option.displayName, Select.Option); + app.component(Select.OptGroup.displayName, Select.OptGroup); return app; }; export default Select as typeof Select & diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index f1cafc9fac..43dafd3156 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -200,7 +200,7 @@ const TreeSelect = defineComponent({ /* istanbul ignore next */ TreeSelect.install = function(app: App) { app.component(TreeSelect.name, TreeSelect); - app.component('ATreeSelectNode', TreeSelect.TreeNode); + app.component(TreeSelect.TreeNode.displayName, TreeSelect.TreeNode); return app; }; diff --git a/components/vc-select/OptGroup.tsx b/components/vc-select/OptGroup.tsx index 2b5deccce2..747f6a03f8 100644 --- a/components/vc-select/OptGroup.tsx +++ b/components/vc-select/OptGroup.tsx @@ -11,4 +11,5 @@ export interface OptionGroupFC extends FunctionalComponent { const OptGroup: OptionGroupFC = () => null; OptGroup.isSelectOptGroup = true; +OptGroup.displayName = 'ASelectOptGroup'; export default OptGroup; diff --git a/components/vc-select/Option.tsx b/components/vc-select/Option.tsx index 9b8cdcad82..cd1c179768 100644 --- a/components/vc-select/Option.tsx +++ b/components/vc-select/Option.tsx @@ -14,4 +14,5 @@ export interface OptionFC extends FunctionalComponent { const Option: OptionFC = () => null; Option.isSelectOption = true; +Option.displayName = 'ASelectOption'; export default Option; diff --git a/components/vc-tree-select/src/SelectNode.jsx b/components/vc-tree-select/src/SelectNode.jsx index 92812fb5d2..925aff3663 100644 --- a/components/vc-tree-select/src/SelectNode.jsx +++ b/components/vc-tree-select/src/SelectNode.jsx @@ -11,4 +11,5 @@ function SelectNode(_, { attrs, slots }) { SelectNode.isTreeNode = true; SelectNode.inheritAttrs = false; +SelectNode.displayName = 'ATreeSelectNode'; export default SelectNode;