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

fix(mp-alipay): remove behavior (#3191)

上级 53f71c3e
......@@ -10,7 +10,6 @@ import {
initWxsCallMethods,
} from '@dcloudio/uni-mp-core'
import {
initBehavior,
handleRef,
handleLink,
triggerEvent,
......@@ -117,7 +116,7 @@ export function initCreateComponent() {
}
if (__VUE_OPTIONS_API__) {
mpComponentOptions.data = initData(vueOptions)
mpComponentOptions.mixins = initBehaviors(vueOptions, initBehavior)
mpComponentOptions.mixins = initBehaviors(vueOptions)
}
if (isComponent2) {
......
......@@ -40,16 +40,6 @@ function customize(str: string) {
return camelize(str.replace(customizeRE, '-'))
}
export function initBehavior({ properties }: Record<string, any>) {
const props: Record<string, any> = {}
Object.keys(properties).forEach((key) => {
props[key] = properties[key].value
})
return {
props,
}
}
export function initRelation(
mpInstance: MPComponentInstance,
detail: RelationOptions
......
......@@ -4,7 +4,7 @@ import { ComponentOptions, ComponentPublicInstance } from 'vue'
// @ts-expect-error
import { getExposeProxy } from 'vue'
import { initExtraOptions, initWxsCallMethods, initBehavior } from './util'
import { initExtraOptions, initWxsCallMethods } from './util'
import { initProps } from './componentProps'
import { applyOptions, initPropsObserver } from './componentOptions'
......@@ -109,7 +109,7 @@ export function parseComponent(
}
if (__VUE_OPTIONS_API__) {
applyOptions(mpComponentOptions, vueOptions, initBehavior)
applyOptions(mpComponentOptions, vueOptions)
}
initProps(mpComponentOptions)
......
......@@ -83,13 +83,8 @@ function hasPropsChanged(
return false
}
export function initBehaviors(
vueOptions: ComponentOptions,
initBehavior: (behavior: any) => string | { props: any }
): string[] {
export function initBehaviors(vueOptions: ComponentOptions): string[] {
const vueBehaviors = vueOptions.behaviors
const vueExtends = vueOptions.extends
const vueMixins = vueOptions.mixins
let vueProps = vueOptions.props
......@@ -118,26 +113,13 @@ export function initBehaviors(
}
})
}
if (vueExtends && vueExtends.props) {
const behavior = {}
behaviors.push(initBehavior(behavior) as string)
}
if (isArray(vueMixins)) {
vueMixins.forEach((vueMixin) => {
if (vueMixin.props) {
const behavior = {}
behaviors.push(initBehavior(behavior) as string)
}
})
}
return behaviors
}
export function applyOptions(
componentOptions: MPComponentOptions,
vueOptions: ComponentOptions,
initBehavior: (behavior: unknown) => string
vueOptions: ComponentOptions
) {
componentOptions.data = initData(vueOptions)
componentOptions.behaviors = initBehaviors(vueOptions, initBehavior)
componentOptions.behaviors = initBehaviors(vueOptions)
}
......@@ -8,10 +8,6 @@ import {
import { MPComponentInstance, MPComponentOptions } from './component'
export function initBehavior(options: any) {
return Behavior(options)
}
export function initVueIds(
vueIds: string | undefined,
mpInstance: MPComponentInstance
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册