Skip to content

Commit

Permalink
fix(input): fix #85 types 错误
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczj committed Sep 27, 2018
1 parent 8f127b0 commit cb94a89
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
16 changes: 7 additions & 9 deletions @types/input.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { MouseEvent, ComponentClass } from 'react'
import { BaseEventFunction, BaseEvent } from '@tarojs/components/types/common'

declare type InputValue = string | number
declare type InputProp = string | number
declare type InputFunction = (value: string | number, event: BaseEvent) => void

import AtComponent from './base'

export interface AtInputProps extends AtComponent{
style?: string

name: string

title?: string
Expand All @@ -23,9 +21,9 @@ export interface AtInputProps extends AtComponent{

disabled?: boolean

maxlength?: number
maxlength?: InputProp

value?: InputValue
value?: InputProp

placeholder?: string

Expand All @@ -37,13 +35,13 @@ export interface AtInputProps extends AtComponent{

confirmType?: string

cursor?: number
cursor?: InputProp

selectionStart?: number
selectionStart?: InputProp

selectionEnd?: number
selectionEnd?: InputProp

cursorSpacing?: number
cursorSpacing?: InputProp

adjustPosition?: boolean

Expand Down
27 changes: 21 additions & 6 deletions src/components/input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,33 @@ export default class AtInput extends AtComponent {
PropTypes.string,
PropTypes.number
]),
name: '',
name: PropTypes.string,
placeholder: PropTypes.string,
placeholderStyle: PropTypes.string,
placeholderClass: PropTypes.string,
title: PropTypes.string,
confirmType: PropTypes.string,
cursor: PropTypes.number,
selectionStart: PropTypes.number,
selectionEnd: PropTypes.number,
cursor: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
selectionStart: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
selectionEnd: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
adjustPosition: PropTypes.bool,
cursorSpacing: PropTypes.number,
maxlength: PropTypes.number,
cursorSpacing: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
maxlength: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
]),
type: PropTypes.string,
disabled: PropTypes.bool,
border: PropTypes.bool,
Expand Down

0 comments on commit cb94a89

Please sign in to comment.