智能照明系统APP-本地串口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
LightingSystemApp-serial/.svn/pristine/cc/cc75c370336613b8a1fc10cecbb...

43 lines
702 B

import {
SOURCE_KEY
} from '../../constants'
import {
proxy
} from './proxy'
import {
setData
} from './data'
import {
initProperties
} from './properties'
export function initState (vm) {
const instanceData = JSON.parse(JSON.stringify(vm.$options.mpOptions.data || {}))
vm[SOURCE_KEY] = instanceData
const propertyDefinition = {
get () {
return vm[SOURCE_KEY]
},
set (value) {
vm[SOURCE_KEY] = value
}
}
Object.defineProperties(vm, {
data: propertyDefinition,
properties: propertyDefinition
})
vm.setData = setData
initProperties(vm, instanceData)
Object.keys(instanceData).forEach(key => {
proxy(vm, SOURCE_KEY, key)
})
}