feat(Picker): add readonly prop (#7105)
This commit is contained in:
@@ -31,6 +31,7 @@ export default createComponent({
|
||||
|
||||
props: {
|
||||
valueKey: String,
|
||||
readonly: Boolean,
|
||||
allowHtml: Boolean,
|
||||
className: String,
|
||||
itemHeight: Number,
|
||||
@@ -99,6 +100,10 @@ export default createComponent({
|
||||
},
|
||||
|
||||
onTouchStart(event) {
|
||||
if (this.readonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.touchStart(event);
|
||||
|
||||
if (this.moving) {
|
||||
@@ -116,6 +121,10 @@ export default createComponent({
|
||||
},
|
||||
|
||||
onTouchMove(event) {
|
||||
if (this.readonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.touchMove(event);
|
||||
|
||||
if (this.direction === 'vertical') {
|
||||
@@ -137,6 +146,10 @@ export default createComponent({
|
||||
},
|
||||
|
||||
onTouchEnd() {
|
||||
if (this.readonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
const distance = this.offset - this.momentumOffset;
|
||||
const duration = Date.now() - this.touchStartTime;
|
||||
const allowMomentum =
|
||||
@@ -164,7 +177,7 @@ export default createComponent({
|
||||
},
|
||||
|
||||
onClickItem(index) {
|
||||
if (this.moving) {
|
||||
if (this.moving || this.readonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user