8000 Revert "fix(b-icon): local component lookup" · bootstrap-vue/bootstrap-vue@4aa544b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4aa544b

Browse files
committed
Revert "fix(b-icon): local component lookup"
This reverts commit edb6ed6.
1 parent e63a539 commit 4aa544b

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/icons/icon.js

Lines changed: 6 additions & 15 deletions
19
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ import { pascalCase, trim } from '../utils/string'
55
import { BIconBlank } from './icons'
66
import { commonIconProps } from './helpers/icon-base'
77

8-
const findIconComponent = (parent, iconName) => {
9-
if (!parent) {
10-
return null
11-
}
12-
const components = (parent.$options || {}).components
13-
const iconComponent = components[iconName]
14-
return iconComponent || findIconComponent(parent.$parent, iconName)
15-
}
16-
178
// Helper BIcon component
189
// Requires the requested icon component to be installed
10
export const BIcon = /*#__PURE__*/ Vue.extend({
@@ -32,13 +23,13 @@ export const BIcon = /*#__PURE__*/ Vue.extend({
3223
},
3324
render(h, { data, props, parent }) {
3425
const icon = pascalCase(trim(props.icon || '')).replace(RX_ICON_PREFIX, '')
35-
26+
const iconName = `BIcon${icon}`
3627
// If parent context exists, we check to see if the icon has been registered
37-
// either locally in the parent component, or globally at the `$root` level
28+
// Either locally in the parent component, or globally at the `$root` level
3829
// If not registered, we render a blank icon
39-
return h(
40-
icon ? findIconComponent(parent, `BIcon${icon}`) || BIconBlank : BIconBlank,
41-
mergeData(data, { props: { ...props, icon: null } })
42-
)
30+
const components = ((parent || {}).$options || {}).components
31+
const componentRefOrName =
32+
icon && components ? components[iconName] || BIconBlank : icon ? iconName : BIconBlank
33+
return h(componentRefOrName, mergeData(data, { props: { ...props, icon: null } }))
4334
}
4435
})

0 commit comments

Comments
 (0)
0