File tree 3 files changed +19
-6
lines changed
3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,23 @@ npm install --save vue-dark-mode-switch
8
8
9
9
## Usage
10
10
Import the ` DarkModeSwitch ` component, and it will emit its state through ` @switched ` event method.
11
+ ` initalState ` props allow to initialize the switch value (optional, default value is false).
11
12
12
13
``` html
13
14
<template >
14
- <DarkModeSwitch @switched =" onSwitched" />
15
+ <DarkModeSwitch @switched =" onSwitched" :initialState = " isDarkModeEnabled " />
15
16
</template >
16
17
17
18
<script >
18
- import DarkModeSwitch from ' ./components/DarkModeSwitch.vue'
19
+ import DarkModeSwitch from ' vue-dark-mode-switch'
20
+ import ' vue-dark-mode-switch/dist/vue-dark-mode-switch.css'
19
21
20
22
export default {
23
+ data () {
24
+ return {
25
+ isDarkModeEnabled: true
26
+ }
27
+ },
21
28
components: {
22
29
DarkModeSwitch
23
30
},
Original file line number Diff line number Diff line change @@ -45,14 +45,20 @@ <h1>VueJS Dark mode switch component</h1>
45
45
< div class ="green "> </ div >
46
46
</ div >
47
47
< pre class ="language-javascript line-numbers "> < code class ="language-html "> <template>
48
- <DarkModeSwitch @switched="onSwitched" />
48
+ <DarkModeSwitch @switched="onSwitched" :initialState="isDarkModeEnabled" />
49
49
</template>
50
50
51
51
<script>
52
- import DarkModeSwitch from './components/DarkModeSwitch.vue'
52
+ import DarkModeSwitch from 'vue-dark-mode-switch'
53
+ import 'vue-dark-mode-switch/dist/vue-dark-mode-switch.css'
53
54
54
55
export default {
55
- components: {
56
+ data () {
57
+ return {
58
+ isDarkModeEnabled: true
59
+ }
60
+ },
61
+ components: {
56
62
DarkModeSwitch
57
63
},
58
64
methods: {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-dark-mode-switch" ,
3
- "version" : " 1.0.5 " ,
3
+ "version" : " 1.0.6 " ,
4
4
"author" : " Ismaïl NGUYEN <nguyen.ismail@gmail.com>" ,
5
5
"repository" : " https://github.com/ismailnguyen/vue-dark-mode-switch.git" ,
6
6
"license" : " WTFPL (http://www.wtfpl.net)" ,
You can’t perform that action at this time.
0 commit comments