1 | import type {
|
2 | VUE_INSTANCE,
|
3 | CONSTRUCTOR_OPTION
|
4 | } from './type'
|
5 |
|
6 | import getLifeCycle from './lifeCycle'
|
7 | import getRender from './render'
|
8 | import mixins from './mixins'
|
9 |
|
10 | export default class VueCompile {
|
11 |
|
12 | constructor (option: CONSTRUCTOR_OPTION): VUE_INSTANCE {
|
13 | return this.getInstance(option)
|
14 | }
|
15 |
|
16 |
|
17 | getInstance (option: CONSTRUCTOR_OPTION): VUE_INSTANCE {
|
18 | const render = getRender(option)
|
19 | const data = option.data || {}
|
20 | return Object.assign(getLifeCycle(option.lifeCycle), {
|
21 | mixins: [mixins],
|
22 | methods: option.method,
|
23 | data: _ => data,
|
24 | render
|
25 | })
|
26 | }
|
27 |
|
28 | }
|