Skip to content

Commit

Permalink
fix(jd): 京东小程序Swiper补全easing-function属性,fix #9078
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-jj committed Apr 25, 2021
1 parent 7f57312 commit 698bca1
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/taro-jd/src/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { singleQuote } from '@tarojs/shared'

export const components = {
// ======== 调整属性 ========
Swiper: {
'easing-function': singleQuote('default')
}
}
24 changes: 24 additions & 0 deletions packages/taro-jd/src/program.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { TaroPlatformBase } from '@tarojs/service'
import { Template } from './template'
import { components } from './components'

const PACKAGE_NAME = '@tarojs/plugin-platform-jd'

Expand All @@ -16,4 +17,27 @@ export default class JD extends TaroPlatformBase {
}

template = new Template()

/**
* 1. setupTransaction - init
* 2. setup
* 3. setupTransaction - close
* 4. buildTransaction - init
* 5. build
* 6. buildTransaction - close
*/
constructor (ctx, config) {
super(ctx, config)

this.setupTransaction.addWrapper({
close: this.modifyTemplate
})
}

/**
* 增加组件或修改组件属性
*/
modifyTemplate () {
this.template.mergeComponents(this.ctx, components)
}
}
1 change: 1 addition & 0 deletions packages/taro-jd/src/runtime-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { initNativeApi } from './apis'

export { initNativeApi }
export * from './components'
export const hostConfig = {
initNativeApi
}
5 changes: 3 additions & 2 deletions packages/taro-jd/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { mergeReconciler } from '@tarojs/shared'
import { hostConfig } from './runtime-utils'
import { mergeReconciler, mergeInternalComponents } from '@tarojs/shared'
import { hostConfig, components } from './runtime-utils'

mergeReconciler(hostConfig)
mergeInternalComponents(components)
5 changes: 5 additions & 0 deletions packages/taro-jd/types/components.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export declare const components: {
Swiper: {
'easing-function': string;
};
};
13 changes: 13 additions & 0 deletions packages/taro-jd/types/program.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,17 @@ export default class JD extends TaroPlatformBase {
script: string;
};
template: Template;
/**
* 1. setupTransaction - init
* 2. setup
* 3. setupTransaction - close
* 4. buildTransaction - init
* 5. build
* 6. buildTransaction - close
*/
constructor(ctx: any, config: any);
/**
* 增加组件或修改组件属性
*/
modifyTemplate(): void;
}
1 change: 1 addition & 0 deletions packages/taro-jd/types/runtime-utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { initNativeApi } from './apis';
export { initNativeApi };
export * from './components';
export declare const hostConfig: {
initNativeApi: typeof initNativeApi;
};

0 comments on commit 698bca1

Please sign in to comment.