-
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
45 changed files
with
526 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function resolveEventValue(event) { | ||
if (typeof event.detail !== 'undefined') { | ||
return event.detail; | ||
} | ||
return event; | ||
} |
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
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 |
---|---|---|
|
@@ -13,3 +13,8 @@ export function platform() { | |
|
||
return platform; | ||
} | ||
|
||
export function resolveEventValue(value) { | ||
|
||
return 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
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,43 @@ | ||
import { resolveEventValue } from './utils'; | ||
Page({ | ||
data: {}, | ||
onChange: function (value) { | ||
console.log('onChange', value); | ||
}, | ||
onFocus: function (value) { | ||
console.log('onFocus', value); | ||
}, | ||
onConfirm: function (value) { | ||
console.log('onConfirm', value); | ||
}, | ||
onBlur: function (value) { | ||
console.log('onBlur', value); | ||
}, | ||
handleChange: function (value) { | ||
console.log('onChange', value); | ||
this.setData({ | ||
value: resolveEventValue(value), | ||
}); | ||
}, | ||
add: function () { | ||
this.setData({ | ||
value: (this.data.value || 0) + 1, | ||
}); | ||
}, | ||
minus: function () { | ||
this.setData({ | ||
value: (this.data.value || 0) - 1, | ||
}); | ||
}, | ||
clear: function () { | ||
this.setData({ | ||
value: null, | ||
}); | ||
}, | ||
handleAddValue: function () { | ||
this.setData({ value: this.data.value + 1 }); | ||
}, | ||
handleMinusValue: function () { | ||
this.setData({ value: this.data.value - 1 }); | ||
}, | ||
}); |
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": "Stepper", | ||
"usingComponents": { | ||
"stepper": "../../../src/Stepper/index", | ||
"container": "../../../src/Container/index", | ||
"ant-button": "../../../src/Button/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,61 @@ | ||
<container title="基础用法"> | ||
<stepper | ||
bind:change="onChange" | ||
onBlur="onBlur" | ||
onConfirm="onConfirm" | ||
onFocus="onFocus" /> | ||
</container> | ||
<container title="初始值"> | ||
<stepper defaultValue="{{ 0 }}" /> | ||
</container> | ||
<container title="step 0.01"> | ||
<stepper | ||
defaultValue="{{ 0 }}" | ||
step="{{ 0.01 }}" | ||
inputStyle="width: 60px" /> | ||
</container> | ||
<container title="precision 1"> | ||
<stepper | ||
defaultValue="{{ 0 }}" | ||
precision="{{ 1 }}" | ||
inputStyle="width: 60px" /> | ||
</container> | ||
<container title="限制输入范围 [0, 10]"> | ||
<stepper | ||
defaultValue="{{ 0 }}" | ||
min="{{ 0 }}" | ||
max="{{ 10 }}" | ||
step="{{ 1 }}" /> | ||
</container> | ||
<container title="禁用状态"> | ||
<stepper | ||
defaultValue="{{ 0 }}" | ||
disabled /> | ||
</container> | ||
<container title="受控组件"> | ||
<stepper | ||
value="{{ value }}" | ||
bind:change="handleChange" | ||
style="margin: 8px 0" | ||
onBlur="onBlur" | ||
onConfirm="onConfirm" | ||
onFocus="onFocus" /> | ||
value: {{ value }} | ||
<view class="list"> | ||
<ant-button | ||
inline | ||
bind:tap="add"> | ||
add | ||
</ant-button> | ||
<ant-button | ||
inline | ||
bind:tap="minus"> | ||
minus | ||
</ant-button> | ||
<ant-button | ||
inline | ||
bind:tap="clear"> | ||
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,3 @@ | ||
.list button { | ||
margin-right: 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,6 @@ | ||
export function resolveEventValue(event) { | ||
if (typeof event.detail !== 'undefined') { | ||
return event.detail; | ||
} | ||
return event; | ||
} |
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
Oops, something went wrong.