mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
feat(typography): text type
This commit is contained in:
parent
714f7fac7b
commit
46e38547bd
@ -4,14 +4,35 @@ import getTheme from './getTheme'
|
||||
export default {
|
||||
name: 'NP',
|
||||
functional: true,
|
||||
props: {
|
||||
primary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
secondary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
tertiary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
render (h, context) {
|
||||
const on = context.listeners
|
||||
const theme = getTheme(context.parent)
|
||||
const props = context.props
|
||||
const defaultSlot = context.slots.default || (context.scopedSlots.default && context.scopedSlots.default())
|
||||
const isPrimary = props.primary
|
||||
const isSecondary = props.secondary
|
||||
const isTertiary = props.tertiary
|
||||
return h('p', {
|
||||
staticClass: 'n-p',
|
||||
class: {
|
||||
[`n-${theme}-theme`]: theme
|
||||
[`n-${theme}-theme`]: theme,
|
||||
'n-p--primary': isPrimary,
|
||||
'n-p--secondary': isSecondary,
|
||||
'n-p--tertiary': isTertiary
|
||||
},
|
||||
...context.data,
|
||||
on
|
||||
|
@ -32,6 +32,18 @@ export default {
|
||||
underline: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
primary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
secondary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
tertiary: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
render (h, context) {
|
||||
@ -43,6 +55,9 @@ export default {
|
||||
const isItalic = props.italic
|
||||
const isDisabled = props.disabled
|
||||
const isUnderline = props.underline
|
||||
const isPrimary = props.primary
|
||||
const isSecondary = props.secondary
|
||||
const isTertiary = props.tertiary
|
||||
const on = context.listeners
|
||||
const theme = getTheme(context.parent)
|
||||
const defaultSlot = context.slots.default || (context.scopedSlots.default && context.scopedSlots.default())
|
||||
@ -56,7 +71,10 @@ export default {
|
||||
'n-text--strong': isStrong,
|
||||
'n-text--italic': isItalic,
|
||||
'n-text--disabled': isDisabled,
|
||||
'n-text--underline': isUnderline
|
||||
'n-text--underline': isUnderline,
|
||||
'n-text--primary': isPrimary,
|
||||
'n-text--secondary': isSecondary,
|
||||
'n-text--tertiary': isTertiary
|
||||
},
|
||||
...context.data,
|
||||
on
|
||||
|
Loading…
Reference in New Issue
Block a user