This repository was archived by the owner on Jun 9, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
+ import Vuex from 'vuex'
2
3
import { play } from '../src/play'
3
4
import MyButton from './MyButton.vue'
4
5
5
6
Vue . component ( 'my-button' , MyButton )
6
7
7
8
play ( 'Button' )
8
9
. add ( 'with text' , {
9
- template : `<my-button :handle-click="log">text</my-button>` ,
10
+ template : `<my-button :handle-click="log">{{ $store.state.count }}</my-button>` ,
11
+ store : new Vuex . Store ( {
12
+ state : { count : 0 }
13
+ } ) ,
10
14
methods : {
11
15
log ( ) {
12
- this . $log ( new Date ( ) )
16
+ this . $store . state . count ++
13
17
}
14
18
}
15
19
} )
Original file line number Diff line number Diff line change 1
1
import MyButton from './MyButton.vue'
2
2
import Box from './Box.vue'
3
3
4
+ import Vuex from 'vuex'
5
+ import Vue from 'vue'
6
+
7
+ Vue . use ( Vuex )
8
+
4
9
const load = requireContext => {
5
10
return requireContext . keys ( ) . map ( requireContext )
6
11
}
Original file line number Diff line number Diff line change @@ -44,11 +44,25 @@ export default function () {
44
44
}
45
45
parent . postMessage ( {
46
46
type : 'SET_SPOTS' ,
47
- payload : JSON . stringify ( spots )
47
+ payload : JSON . stringify ( purify ( spots ) )
48
48
} , location . origin )
49
49
} ,
50
50
render ( h ) {
51
51
return h ( 'div' , { attrs : { id : 'app' } } , [ h ( this . current ) ] )
52
52
}
53
53
} )
54
54
}
55
+
56
+ function purify ( spots ) {
57
+ const result = { }
58
+ for ( const name in spots ) {
59
+ result [ name ] = spots [ name ] . map ( spot => ( {
60
+ scenario : spot . scenario ,
61
+ component : {
62
+ example : spot . component . example ,
63
+ template : spot . component . template
64
+ }
65
+ } ) )
66
+ }
67
+ return result
68
+ }
You can’t perform that action at this time.
0 commit comments