Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复小程序自定义组件无法设置 className 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Nov 24, 2020
1 parent 3fb31e5 commit d253627
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ Object {
],
"id": 2,
"props": Object {
"class": "foo",
"className": "foo",
},
"text": undefined,
"type": "view",
Expand All @@ -654,7 +654,7 @@ Array [
"children": Array [],
"id": 1,
"props": Object {
"class": "class",
"className": "class",
"fooBar": "fooBar",
"onClick": "$$REMAX_METHOD_1_onClick",
},
Expand Down Expand Up @@ -890,7 +890,7 @@ Object {
"children": Array [],
"id": 1,
"props": Object {
"class": "className",
"className": "className",
"disabled": false,
"style": "display:flex;flex:1;",
},
Expand Down Expand Up @@ -920,7 +920,7 @@ Object {
"children": Array [],
"id": 1,
"props": Object {
"class": "updateClassName",
"className": "updateClassName",
"disabled": true,
"style": "display:flex;flex:2;",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ Object {
},
},
"props": Object {
"class": "foo",
"className": "foo",
},
"text": undefined,
"type": "view",
Expand All @@ -400,7 +400,7 @@ Array [
"children": Array [],
"id": 1,
"props": Object {
"class": "class",
"className": "class",
"fooBar": "fooBar",
"onClick": "$$REMAX_METHOD_1_onClick",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ Object {
},
},
"props": Object {
"class": "foo",
"className": "foo",
},
"text": undefined,
"type": "view",
Expand All @@ -400,7 +400,7 @@ Array [
"children": Array [],
"id": 1,
"props": Object {
"class": "class",
"className": "class",
"fooBar": "fooBar",
"onClick": "$$REMAX_METHOD_1_onClick",
},
Expand Down
15 changes: 0 additions & 15 deletions packages/remax-runtime/src/__tests__/propsAlias.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,6 @@ describe('props alias', () => {
RuntimeOptions.reset();
});

it('transform className prop correctly', () => {
expect(getAlias('className', 'any')).toBe('class');

expect(
propsAlias(
{
className: 'class-name',
},
'any'
)
).toEqual({
class: 'class-name',
});
});

it('transform style prop correctly', () => {
expect(
propsAlias(
Expand Down
2 changes: 0 additions & 2 deletions packages/remax-runtime/src/propsAlias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import plainStyle from './utils/plainStyle';
import { RuntimeOptions } from '@remax/framework-shared';

export function getAlias(prop: string, type: string) {
prop = prop.replace('className', 'class');

const hostComponent = RuntimeOptions.get('hostComponents')[type];

const prefix = `${RuntimeOptions.get('platform')}-`;
Expand Down

1 comment on commit d253627

@vercel
Copy link

@vercel vercel bot commented on d253627 Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.