智能照明系统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/11/1151128bab32b4710c788ac13e0...

31 lines
757 B

import {
cached
} from 'uni-shared'
const pageFactory = Object.create(null)
export function definePage (name, createPageVueComponent) {
pageFactory[name] = createPageVueComponent
}
export const getPageVueComponent = cached(function (pagePath) {
return pageFactory[pagePath]()
})
export function createPage (pagePath, pageId, pageQuery, pageInstance) {
if (!pageFactory[pagePath]) {
console.error(`${pagePath} not found`)
}
const startTime = Date.now()
const pageVm = new (getPageVueComponent(pagePath))({
mpType: 'page',
pageId,
pagePath,
pageQuery,
pageInstance
})
if (process.env.NODE_ENV !== 'production') {
console.log(`new ${pagePath}[${pageId}]:time(${Date.now() - startTime})`)
}
return pageVm
}