Skip to content

Commit 526d0f9

Browse files
committed
feat: Allow to import the component individually
1 parent c772954 commit 526d0f9

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"module": "dist/vue-dark-mode.esm.js",
77
"unpkg": "dist/vue-dark-mode.min.js",
88
"browser": {
9-
"./sfc": "src/vue-dark-mode.vue"
9+
"./sfc": "src/DarkMode.vue"
1010
},
1111
"scripts": {
1212
"dev": "rollup --config rollup.config.dev.js --watch",
File renamed without changes.

src/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import VueDarkMode from './VueDarkMode.vue'
1+
import VueDarkMode from './plugin'
22

3-
export default function install (Vue) {
4-
if (install.installed) return
5-
install.installed = true
6-
Vue.component('VueDarkMode', VueDarkMode)
7-
}
8-
9-
// auto install
10-
if (typeof window !== 'undefined' && typeof window.Vue !== 'undefined') {
11-
window.Vue.use(install)
12-
}
3+
export default VueDarkMode
4+
export { default as DarkMode } from './DarkMode.vue'

src/plugin.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import DarkMode from './DarkMode.vue'
2+
3+
export default function install (Vue) {
4+
if (install.installed) return
5+
install.installed = true
6+
Vue.component('DarkMode', DarkMode)
7+
}
8+
9+
// auto install
10+
if (typeof window !== 'undefined' && typeof window.Vue !== 'undefined') {
11+
window.Vue.use(install)
12+
}

0 commit comments

Comments
 (0)