mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-12 12:25:16 +08:00
feat(n-element)
This commit is contained in:
parent
a3b970ffe2
commit
ffc943954d
9
packages/common/Element/index.js
Normal file
9
packages/common/Element/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
/* istanbul ignore file */
|
||||
import Element from './src/main.vue'
|
||||
|
||||
Element.install = function (Vue) {
|
||||
Vue.component(Element.name, Element)
|
||||
Vue.component('NEl', Element)
|
||||
}
|
||||
|
||||
export default Element
|
23
packages/common/Element/src/main.vue
Normal file
23
packages/common/Element/src/main.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<script>
|
||||
import withapp from '../../../mixins/withapp'
|
||||
import themeable from '../../../mixins/themeable'
|
||||
import asthemecontext from '../../../mixins/asthemecontext'
|
||||
|
||||
export default {
|
||||
name: 'NElement',
|
||||
mixins: [withapp, themeable, asthemecontext],
|
||||
props: {
|
||||
as: {
|
||||
type: String,
|
||||
default: 'div'
|
||||
}
|
||||
},
|
||||
render (h) {
|
||||
return h(this.as, {
|
||||
class: {
|
||||
[`n-${this.synthesizedTheme}-theme`]: this.synthesizedTheme
|
||||
}
|
||||
}, this.$slots.default || (this.$scopedSlots.default && this.$scopedSlots.default()) || null)
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user