mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-17 13:20:52 +08:00
feat(app): inherit theme
This commit is contained in:
parent
28262b5ee9
commit
1b11ba77a3
@ -4,4 +4,5 @@ App is using to set global theme and set namespace for components (detached part
|
||||
```demo
|
||||
theme
|
||||
namespace
|
||||
inherit-theme
|
||||
```
|
7
demo/documentation/components/app/enUS/inheritTheme.md
Normal file
7
demo/documentation/components/app/enUS/inheritTheme.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Inherit Theme
|
||||
If you don't set theme of app, the theme of app is inherited by default.
|
||||
```html
|
||||
<n-app>
|
||||
<n-tag>Oops</n-tag>
|
||||
</n-app>
|
||||
```
|
@ -18,6 +18,11 @@ export default {
|
||||
NApp: this
|
||||
}
|
||||
},
|
||||
inject: {
|
||||
NApp: {
|
||||
default: null
|
||||
}
|
||||
},
|
||||
props: {
|
||||
namespace: {
|
||||
type: String,
|
||||
@ -27,6 +32,15 @@ export default {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
synthesizedTheme () {
|
||||
if (this.theme !== null) {
|
||||
return this.theme
|
||||
} else {
|
||||
return (this.NApp && this.NApp.synthesizedTheme) || null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -10,7 +10,7 @@ export default {
|
||||
if (this.theme !== null) {
|
||||
return this.theme
|
||||
} else {
|
||||
return (this.NApp && this.NApp.theme) || null
|
||||
return (this.NApp && this.NApp.synthesizedTheme) || null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user