mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-27 04:09:51 +08:00
refactor: mount global style when install
This commit is contained in:
parent
f36f787668
commit
3f86771a6a
@ -1,5 +1,4 @@
|
||||
import { find } from '../_utils/cssr'
|
||||
import globalStyle from '../_styles/global/index.cssr.js'
|
||||
import { warn } from '../_utils'
|
||||
|
||||
if (__DEV__) {
|
||||
@ -198,10 +197,6 @@ const usecssr = function (styles = [], cssrPropsOption) {
|
||||
}
|
||||
} : undefined,
|
||||
beforeMount () {
|
||||
globalStyle.mount({
|
||||
target: 'naive-ui-global',
|
||||
count: false
|
||||
})
|
||||
styles.forEach(style => {
|
||||
if (__DEV__) {
|
||||
window.naive.styleRenderingDuration -= performance.now()
|
||||
|
3
src/_styles/index.js
Normal file
3
src/_styles/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
export {
|
||||
default as globalStyle
|
||||
} from './global/index.cssr.js'
|
@ -1,4 +1,5 @@
|
||||
import version from './version'
|
||||
import { globalStyle } from './_styles'
|
||||
import { warn } from './_utils'
|
||||
|
||||
function setHljs (hljs) {
|
||||
@ -72,6 +73,10 @@ function create (options = {}) {
|
||||
}
|
||||
function install (app) {
|
||||
if (installTargets.includes(app)) return
|
||||
globalStyle.mount({
|
||||
target: 'naive-ui-global',
|
||||
count: false
|
||||
})
|
||||
installTargets.push(app)
|
||||
app.config.globalProperties.$naive = naive
|
||||
components.forEach(component => {
|
||||
|
Loading…
Reference in New Issue
Block a user