提交 c69c516b 编写于 作者: fxy060608's avatar fxy060608

feat(v3): init createVueComponent

上级 55c2e4de
此差异已折叠。
import {
parseProperties
} from './parser'
export default function createVueComponent (mpComponentOptions) {
const vueComponentOptions = {
watch: {},
mpObservers: []
}
parseProperties(mpComponentOptions.properties, vueComponentOptions)
return vueComponentOptions
}
export function parseBehaviors (behaviors, vueComponentOptions) {
if (!behaviors) {
}
}
export function parseData (data, vueComponentOptions) {
if (!data) {
return
}
const dataJson = JSON.stringify(data)
vueComponentOptions.data = function () {
return JSON.parse(dataJson)
}
}
export function parseDefinitionFilter (definitionFilter, vueComponentOptions) {
if (!definitionFilter) {
}
}
export function parseExternalClasses (externalClasses, vueComponentOptions) {
if (!externalClasses) {
}
}
export * from './proerties-parser'
export * from './data-parser'
export * from './observers-parser'
export * from './behaviors-parser'
export * from './methods-parser'
export * from './lifecycle-parser'
export * from './relations-parser'
export * from './external-classes-parser'
export * from './options-parser'
export * from './lifetimes-parser'
export * from './page-lifetimes-parser'
export * from './definition-filter-parser'
export function parseLifecycle (mpComponentOptions, vueComponentOptions) {
}
export function parseLifetimes (lifetimes, vueComponentOptions) {
if (!lifetimes) {
}
}
export function parseMethods (methods, vueComponentOptions) {
if (!methods) {
return
}
vueComponentOptions.methods = methods
}
function parseSinglePath (path) {
return path.split('.')
}
function parseMultiPaths (paths) {
return paths.split(',').map(path => parseSinglePath(path))
}
export function parseObservers (observers, vueComponentOptions) {
if (!observers) {
return
}
const {
mpObservers
} = vueComponentOptions
Object.keys(observers).forEach(path => {
mpObservers.push({
paths: parseMultiPaths(path),
observer: observers[path]
})
})
}
export function parseOptions (options, vueComponentOptions) {
if (!options) {
}
}
export function parsePageLifetimes (pageLifetimes, vueComponentOptions) {
if (!pageLifetimes) {
}
}
import {
hasOwn
} from 'uni-shared'
function parseProperty (name, property, watch) {
const type = [property.type]
if (Array.isArray(property.optionalTypes)) {
type.push(...property.optionalTypes)
}
const prop = Object.create(null)
prop.type = type
if (hasOwn(property, 'value')) {
prop['default'] = prop.value
}
if (hasOwn(property, 'observer')) {
watch[name] = property.observer
}
return prop
}
export function parseProperties (properties, vueComponentOptions) {
if (!properties) {
return
}
const props = Object.create(null)
const {
watch
} = vueComponentOptions
Object.keys(properties).forEach(name => {
props[name] = parseProperty(name, properties[name], watch)
})
vueComponentOptions.props = props
}
export function parseRelations (relations, vueComponentOptions) {
if (!relations) {
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册