智能照明系统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/a3/a3f17db43968eaa553635c458eb...

52 lines
1.3 KiB

import Vue from 'vue'
import {
parsePage
} from './parser/page-parser'
import {
parseComponent
} from './parser/component-parser'
import {
handleRelations
} from './polyfill/relations'
import polyfill from './polyfill/index'
global.__wxRoute = ''
global.__wxComponents = Object.create(null)
global.__wxVueOptions = Object.create(null)
export function Page (options) {
const pageOptions = parsePage(options)
pageOptions.mixins.unshift(polyfill)
pageOptions.mpOptions.path = global.__wxRoute
global.__wxComponents[global.__wxRoute] = pageOptions
}
function initRelationsHandler (vueComponentOptions) {
// linked 需要在当前组件 attached 之后再执行
if (!vueComponentOptions.onServiceAttached) {
vueComponentOptions.onServiceAttached = []
}
vueComponentOptions.onServiceAttached.push(function onServiceAttached () {
handleRelations(this, 'linked')
})
}
export function Component (options) {
const componentOptions = parseComponent(options)
componentOptions.mixins.unshift(polyfill)
componentOptions.mpOptions.path = global.__wxRoute
initRelationsHandler(componentOptions)
global.__wxComponents[global.__wxRoute] = componentOptions
}
export function Behavior (options) {
return options
}
export const nextTick = Vue.nextTick
export default uni.__$wx__