mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-18 12:34:25 +08:00
fix(tusimple-theme): clean up styles before unmount
This commit is contained in:
parent
33810c1a9d
commit
5b7040a33d
@ -5,8 +5,7 @@ import {
|
||||
defineComponent,
|
||||
PropType,
|
||||
provide,
|
||||
reactive,
|
||||
onBeforeMount
|
||||
reactive
|
||||
} from 'vue'
|
||||
import { useMemo } from 'vooks'
|
||||
import { warn, getSlot } from '../../_utils'
|
||||
@ -41,7 +40,6 @@ export const configProviderProps = {
|
||||
themeOverrides: Object as PropType<GlobalThemeOverrides | null>,
|
||||
componentOptions: Object as PropType<ComponentProps>,
|
||||
icons: Object as PropType<Icons>,
|
||||
onBeforeMount: Function,
|
||||
// deprecated
|
||||
legacyTheme: String,
|
||||
language: {
|
||||
@ -132,10 +130,6 @@ export default defineComponent({
|
||||
if (componentOptions !== undefined) return componentOptions
|
||||
return NConfigProvider?.mergedComponentProps
|
||||
})
|
||||
onBeforeMount(() => {
|
||||
const { onBeforeMount } = props
|
||||
onBeforeMount?.()
|
||||
})
|
||||
provide<ConfigProviderInjection>(
|
||||
'NConfigProvider',
|
||||
reactive({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { h, defineComponent } from 'vue'
|
||||
import { h, defineComponent, onBeforeMount, onBeforeUnmount } from 'vue'
|
||||
import { NConfigProvider, configProviderProps } from 'naive-ui'
|
||||
import { renderFilter, renderSorter } from './data-table'
|
||||
import { unconfigurableStyle, mountSvgDefs } from './unconfigurable-style'
|
||||
@ -9,6 +9,15 @@ export default defineComponent({
|
||||
name: 'TsConfigProvider',
|
||||
props: configProviderProps,
|
||||
setup () {
|
||||
onBeforeMount(() => {
|
||||
mountSvgDefs()
|
||||
unconfigurableStyle.mount({
|
||||
id: 'naive-ui/tusimple-theme'
|
||||
})
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
unconfigurableStyle.unmount()
|
||||
})
|
||||
return {
|
||||
componentOptions: {
|
||||
Pagination: {
|
||||
@ -27,13 +36,7 @@ export default defineComponent({
|
||||
DynamicInput: {
|
||||
buttonSize: 'small'
|
||||
}
|
||||
} as const,
|
||||
onBeforeMount () {
|
||||
mountSvgDefs()
|
||||
unconfigurableStyle.mount({
|
||||
id: 'naive-ui/tusimple-theme'
|
||||
})
|
||||
}
|
||||
} as const
|
||||
}
|
||||
},
|
||||
render () {
|
||||
@ -43,7 +46,6 @@ export default defineComponent({
|
||||
themeOverrides={themeOverrides}
|
||||
componentOptions={this.componentOptions}
|
||||
icons={icons}
|
||||
onBeforeMount={this.onBeforeMount}
|
||||
>
|
||||
{this.$slots}
|
||||
</NConfigProvider>
|
||||
|
Loading…
Reference in New Issue
Block a user