提交 c589b4ab 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

fix(mp): 修复 uni://form-field 解析错误

#4960
上级 6b5d95ef
import { initBehaviors } from '../../src/runtime/componentOptions'
// import { initBehaviors } from '@dcloudio/uni-mp-core'
describe('test:runtime/componentOptions', () => {
it('test: initBehaviors', () => {
expect(typeof initBehaviors).toBe('function')
const options = {
behaviors: ['uni://form-field'],
}
const behaviors = initBehaviors(options)
expect(behaviors).toEqual(['__GLOBAL__://form-field'])
})
})
......@@ -118,7 +118,8 @@ export function initBehaviors(vueOptions: ComponentOptions): string[] {
const behaviors: string[] = []
if (isArray(vueBehaviors)) {
vueBehaviors.forEach((behavior) => {
behaviors.push(behavior.replace('uni://', '__GLOBAL__://'))
// 这里的 global 应该是个变量
behaviors.push(behavior.replace('uni://', '__GLOBAL__' + '://'))
if (behavior === 'uni://form-field') {
if (isArray(vueProps)) {
vueProps.push('name')
......
......@@ -55,7 +55,7 @@ function initDefaultProps(
}
if (options.behaviors) {
// wx://form-field
if (options.behaviors.includes('__GLOBAL__://form-field')) {
if (options.behaviors.includes('__GLOBAL__' + '://form-field')) {
if (!options.properties || !options.properties.name) {
properties.name = {
type: null,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册