-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,068 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Page({ | ||
data: { | ||
value: '', | ||
money: '', | ||
}, | ||
onChange: function (value, e) { | ||
console.log(value, e); | ||
}, | ||
handleChange: function (value) { | ||
this.setData({ | ||
value: value, | ||
}); | ||
}, | ||
handleMoney: function (value) { | ||
console.log(value); | ||
if (isNaN(Number(value))) { | ||
return; | ||
} | ||
this.setData({ | ||
money: value, | ||
}); | ||
}, | ||
clear: function () { | ||
this.setData({ | ||
value: '', | ||
}); | ||
}, | ||
handleRef: function (input) { | ||
this.input = input; | ||
}, | ||
clearByInputRef: function () { | ||
this.input.update(''); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"defaultTitle": "Input", | ||
"usingComponents": { | ||
"ant-input": "../../../src/Input/index", | ||
"ant-button": "../../../src/Button/index", | ||
"container": "../../../src/Container/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<container title="基础用法"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
</container> | ||
|
||
<container title="初始值"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
defaultValue="这是antd mini小程序组件" | ||
bind:change="onChange" /> | ||
</container> | ||
|
||
<container title="带清除按钮"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
allowClear /> | ||
</container> | ||
|
||
<container title="带有前缀后缀"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
bind:change="onChange" | ||
allowClear> | ||
<view slot="prefix">¥</view> | ||
<view slot="suffix">RMB</view> | ||
</ant-input> | ||
</container> | ||
|
||
<container title="禁用状态"> | ||
<ant-input | ||
placeholder="被禁用的输入框" | ||
disabled="{{ true }}" /> | ||
</container> | ||
|
||
<container title="受控模式"> | ||
<ant-input | ||
value="{{ value }}" | ||
placeholder="请输入内容" | ||
allowClear | ||
bind:change="handleChange" /> | ||
<ant-button | ||
bind:tap="clear" | ||
inline | ||
size="small"> | ||
clear | ||
</ant-button> | ||
</container> | ||
|
||
<container title="受控模式-输入金额"> | ||
<ant-input | ||
placeholder="请输入金额" | ||
value="{{ money }}" | ||
bind:change="handleMoney" | ||
type="digit" | ||
className="input money" | ||
focusClassName="border"> | ||
<view slot="prefix">¥</view> | ||
<view slot="suffix">RMB</view> | ||
</ant-input> | ||
</container> | ||
|
||
<container title="非受控模式通过ref修改input"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
bind:change="onChange" | ||
ref="handleRef" /> | ||
|
||
<view> | ||
<ant-button | ||
inline | ||
bind:tap="clearByInputRef"> | ||
clear | ||
</ant-button> | ||
</view> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.input { | ||
padding: 4px 0 4px 0; | ||
border-radius: 4px; | ||
border: 1px solid transparent; | ||
transition: all 1s; | ||
} | ||
.money { | ||
width: 180px; | ||
} | ||
.border { | ||
border-color: #1677ff; | ||
} | ||
button { | ||
margin-top: 8px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Page({ | ||
data: { | ||
value: '', | ||
money: '', | ||
}, | ||
onChange: function (value, e) { | ||
console.log(value, e); | ||
}, | ||
handleChange: function (value) { | ||
this.setData({ | ||
value: value, | ||
}); | ||
}, | ||
handleMoney: function (value) { | ||
console.log(value); | ||
if (isNaN(Number(value))) { | ||
return; | ||
} | ||
this.setData({ | ||
money: value, | ||
}); | ||
}, | ||
clear: function () { | ||
this.setData({ | ||
value: '', | ||
}); | ||
}, | ||
handleRef: function (input) { | ||
this.input = input; | ||
}, | ||
clearByInputRef: function () { | ||
this.input.update(''); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"defaultTitle": "Input", | ||
"usingComponents": { | ||
"ant-input": "../../../src/Input/index", | ||
"ant-textarea": "../../../src/Input/Textarea/index", | ||
"ant-icon": "../../../src/Icon/index", | ||
"container": "../../../src/Container/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<container title="带有border"> | ||
<ant-input | ||
className="custom" | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
|
||
<ant-input | ||
className="custom" | ||
placeholder="请输入内容" | ||
bind:change="onChange"> | ||
<ant-icon | ||
type="SearchOutline" | ||
slot="prefix" /> | ||
<ant-icon | ||
type="AudioOutline" | ||
slot="suffix" /> | ||
</ant-input> | ||
|
||
<ant-textarea | ||
className="custom" | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
</container> | ||
|
||
<container title="自定义颜色"> | ||
<ant-input | ||
className="custom-color" | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
|
||
<ant-textarea | ||
className="custom-color" | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
</container> | ||
|
||
<container title="自定义placeholderClassName"> | ||
<ant-input | ||
placeholderClassName="placeholder" | ||
placeholder="请输入内容" | ||
bind:change="onChange" /> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.custom { | ||
border: 1px solid #eeeeee; | ||
padding: 4px; | ||
border-radius: 4px; | ||
margin-bottom: 12px; | ||
} | ||
.placeholder { | ||
color: #333333; | ||
opacity: 0.7; | ||
font-size: 16px; | ||
} | ||
.custom-color { | ||
margin-bottom: 12px; | ||
} | ||
.custom-color input, | ||
.custom-color textarea { | ||
padding: 4px; | ||
background: #f5f5f5; | ||
border-radius: 4px; | ||
} | ||
textarea { | ||
min-height: 100px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Page({ | ||
onChange: function (value, e) { | ||
console.log(value, e); | ||
}, | ||
onConfirm: function (value) { | ||
my.alert({ | ||
content: value, | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"defaultTitle": "Input", | ||
"usingComponents": { | ||
"ant-input": "../../../src/Input/index", | ||
"icon": "../../../src/Icon/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<view class="container"> | ||
<ant-input | ||
placeholder="请输入内容" | ||
bind:change="onChange" | ||
className="search-bar" | ||
focusClassName="search-bar-focus" | ||
confirm-type="search" | ||
allowClear | ||
focus | ||
onConfirm="onConfirm"> | ||
<icon | ||
slot="prefix" | ||
type="SearchOutline" /> | ||
|
||
<icon | ||
slot="suffix" | ||
type="AudioOutline" /> | ||
</ant-input> | ||
<view class="cancel">取消</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.container { | ||
display: flex; | ||
align-items: center; | ||
padding: 16px; | ||
} | ||
.search-bar { | ||
padding: 4px 0 4px 0; | ||
border-radius: 4px; | ||
border: 1px solid transparent; | ||
transition: all 0.4s; | ||
flex: 1; | ||
} | ||
.search-bar-focus { | ||
border-color: #1677ff; | ||
} | ||
.cancel { | ||
color: #333333; | ||
margin-left: 8px; | ||
} |
Oops, something went wrong.