Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit 52846ce

Browse files
author
pengshanglong
committed
fix: tsx 组件props写法
1 parent e89832f commit 52846ce

File tree

18 files changed

+225
-184
lines changed

18 files changed

+225
-184
lines changed

src/components/calendar/controller/index.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ const AtCalendarController = Vue.extend({
1515
},
1616
onSelectDate: {
1717
type: Function,
18-
default: () => () => {},
18+
default: function () {
19+
return function () {}
20+
},
1921
},
2022
onPreMonth: {
2123
type: Function,
22-
default: () => () => {},
24+
default: function () {
25+
return function () {}
26+
},
2327
},
2428
onNextMonth: {
2529
type: Function,
26-
default: () => () => {},
30+
default: function () {
31+
return function () {}
32+
},
2733
},
2834
monthFormat: {
2935
type: String,

src/components/calendar/ui/date-list/index.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,21 @@ const AtCalendarList = Vue.extend({
1515
props: {
1616
list: {
1717
type: Array,
18-
default: () => [],
18+
default: function () {
19+
return []
20+
},
1921
},
2022
onClick: {
2123
type: Function,
22-
default: () => () => {},
24+
default: function () {
25+
return function () {}
26+
},
2327
},
2428
onLongClick: {
2529
type: Function,
26-
default: () => () => {},
30+
default: function () {
31+
return function () {}
32+
},
2733
},
2834
},
2935
data() {

src/components/checkbox/index.tsx

+15-5
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,33 @@ const AtCheckbox = Vue.extend({
66
props: {
77
customStyle: {
88
type: [Object, String],
9-
default: () => {},
9+
default: function () {
10+
return {}
11+
},
1012
},
1113
className: {
1214
type: [Object, String],
13-
default: () => {},
15+
default: function () {
16+
return {}
17+
},
1418
},
1519
options: {
1620
type: Array,
17-
default: () => [],
21+
default: function () {
22+
return []
23+
},
1824
},
1925
selectedList: {
2026
type: Array,
21-
default: () => [],
27+
default: function () {
28+
return []
29+
},
2230
},
2331
onChange: {
2432
type: Function,
25-
default: () => () => {},
33+
default: function () {
34+
return function () {}
35+
},
2636
},
2737
},
2838
methods: {

src/components/class-component-demo.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@ const AtTagProps = Vue.extend({
4242
},
4343
customStyle: {
4444
type: [Object, String],
45-
default: () => {},
45+
default: function () {
46+
return {}
47+
},
4648
},
4749
className: {
4850
type: [Object, String],
49-
default: () => {},
51+
default: function () {
52+
return {}
53+
},
5054
},
5155
onClick: {
5256
type: Function,
53-
default: () => () => {},
57+
default: function () {
58+
return function () {}
59+
},
5460
},
5561
},
5662
})

src/components/form/index.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@ const AtForm = Vue.extend({
66
props: {
77
customStyle: {
88
type: [Object, String],
9-
default: () => {},
9+
default: function () {
10+
return {}
11+
},
1012
},
1113
className: {
1214
type: [Object, String],
13-
default: () => {},
15+
default: function () {
16+
return {}
17+
},
1418
},
1519
reportSubmit: {
1620
type: Boolean,
1721
default: false,
1822
},
1923
onSubmit: {
2024
type: Function,
21-
default: () => () => {},
25+
default: function () {
26+
return function () {}
27+
},
2228
},
2329
onReset: {
2430
type: Function,
25-
default: () => () => {},
31+
default: function () {
32+
return function () {}
33+
},
2634
},
2735
},
2836
methods: {

src/components/image-picker/index.tsx

+18-6
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,21 @@ const AtImagePicker = Vue.extend({
4242
props: {
4343
customStyle: {
4444
type: [Object, String],
45-
default: () => {},
45+
default: function () {
46+
return {}
47+
},
4648
},
4749
className: {
4850
type: [Object, String],
49-
default: () => {},
51+
default: function () {
52+
return {}
53+
},
5054
},
5155
files: {
5256
type: Array,
53-
default: () => [],
57+
default: function () {
58+
return []
59+
},
5460
},
5561
mode: {
5662
type: String,
@@ -88,15 +94,21 @@ const AtImagePicker = Vue.extend({
8894
},
8995
onChange: {
9096
type: Function,
91-
default: () => () => {},
97+
default: function () {
98+
return function () {}
99+
},
92100
},
93101
onImageClick: {
94102
type: Function,
95-
default: () => () => {},
103+
default: function () {
104+
return function () {}
105+
},
96106
},
97107
onFail: {
98108
type: Function,
99-
default: () => () => {},
109+
default: function () {
110+
return function () {}
111+
},
100112
},
101113
},
102114
methods: {

src/components/input-number/index.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@ const AtInputNumber = Vue.extend({
4444
props: {
4545
customStyle: {
4646
type: [Object, String],
47-
default: () => {},
47+
default: function () {
48+
return {}
49+
},
4850
},
4951
className: {
5052
type: [Object, String],
51-
default: () => {},
53+
default: function () {
54+
return {}
55+
},
5256
},
5357
disabled: {
5458
type: Boolean,
@@ -90,11 +94,15 @@ const AtInputNumber = Vue.extend({
9094
},
9195
onChange: {
9296
type: Function,
93-
default: () => () => {},
97+
default: function () {
98+
return function () {}
99+
},
94100
},
95101
onBlur: {
96102
type: Function,
97-
default: () => () => {},
103+
default: function () {
104+
return function () {}
105+
},
98106
},
99107
},
100108
methods: {

src/components/input/index.tsx

+28-12
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import {
88
InputEventDetail,
99
KeyboardHeightEventDetail,
1010
} from 'types/input'
11-
import { InputProps } from '@tarojs/components/types/Input'
11+
// import { InputProps } from '@tarojs/components/types/Input'
1212
import { BaseEventOrig, ITouchEvent } from '@tarojs/components/types/common'
1313

14-
type PickAtInputProps = Pick<AtInputProps, 'maxLength' | 'disabled' | 'password'>
15-
type GetInputPropsReturn = PickAtInputProps & Pick<InputProps, 'type'>
14+
// type PickAtInputProps = Pick<AtInputProps, 'maxLength' | 'disabled' | 'password'>
15+
// type GetInputPropsReturn = PickAtInputProps & Pick<InputProps, 'type'>
1616

17-
function getInputProps(props: AtInputProps): GetInputPropsReturn {
17+
function getInputProps(props: AtInputProps) {
1818
const actualProps = {
1919
type: props.type,
2020
maxLength: props.maxLength,
@@ -45,11 +45,15 @@ const AtInput = Vue.extend({
4545
props: {
4646
customStyle: {
4747
type: [Object, String],
48-
default: () => {},
48+
default: function () {
49+
return {}
50+
},
4951
},
5052
className: {
5153
type: [Object, String],
52-
default: () => {},
54+
default: function () {
55+
return {}
56+
},
5357
},
5458
value: {
5559
type: [String, Number],
@@ -141,27 +145,39 @@ const AtInput = Vue.extend({
141145
},
142146
onChange: {
143147
type: Function,
144-
default: () => () => {},
148+
default: function () {
149+
return function () {}
150+
},
145151
},
146152
onFocus: {
147153
type: Function,
148-
default: () => () => {},
154+
default: function () {
155+
return function () {}
156+
},
149157
},
150158
onBlur: {
151159
type: Function,
152-
default: () => () => {},
160+
default: function () {
161+
return function () {}
162+
},
153163
},
154164
onConfirm: {
155165
type: Function,
156-
default: () => () => {},
166+
default: function () {
167+
return function () {}
168+
},
157169
},
158170
onErrorClick: {
159171
type: Function,
160-
default: () => () => {},
172+
default: function () {
173+
return function () {}
174+
},
161175
},
162176
onClick: {
163177
type: Function,
164-
default: () => () => {},
178+
default: function () {
179+
return function () {}
180+
},
165181
},
166182
},
167183
methods: {

src/components/radio/index.tsx

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,31 @@ const AtRadio = Vue.extend({
88
props: {
99
customStyle: {
1010
type: [Object, String],
11-
default: () => {},
11+
default: function () {
12+
return {}
13+
},
1214
},
1315
className: {
1416
type: [Object, String],
15-
default: () => {},
17+
default: function () {
18+
return {}
19+
},
1620
},
1721
value: {
1822
type: String,
1923
default: '',
2024
},
2125
options: {
2226
type: Array,
23-
default: () => [],
27+
default: function () {
28+
return []
29+
},
2430
},
2531
onClick: {
2632
type: Function,
27-
default: () => () => {},
33+
default: function () {
34+
return function () {}
35+
},
2836
},
2937
},
3038
methods: {

src/components/range/index.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ const AtRange = Vue.extend({
1010
props: {
1111
customStyle: {
1212
type: [Object, String],
13-
default: () => {},
13+
default: function () {
14+
return {}
15+
},
1416
},
1517
className: {
1618
type: [Object, String],
17-
default: () => {},
19+
default: function () {
20+
return {}
21+
},
1822
},
1923
sliderStyle: {
2024
type: String,

0 commit comments

Comments
 (0)