Skip to content

Commit

Permalink
fix: update back and on input error
Browse files Browse the repository at this point in the history
  • Loading branch information
yociduo committed Sep 8, 2020
1 parent 1851cd9 commit af9537b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
12 changes: 4 additions & 8 deletions client/src/components/input-box.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
<view class="shadow" style="opacity:{{ shadowOpacity }};animation:{{ shadowAnimation }} 0.35s;" />
<view class="modal" style="bottom:{{ modalBottom }}rpx;height:{{ modalHeight }}rpx;opacity:{{ modalOpacity }};animation:{{ modalAnimation }} 0.35s;">
<text class="title">{{ title }}</text>
<input class="singleline-input" value="{{text}}" @blur="onBlur" placeholder="{{ placeholder }}" cursor-spacing="150" maxlength="{{ maxlength }}" wx:if="{{ !multiline }}" />
<textarea class="multiline-input" value="{{text}}" @blur="onBlur" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" cursor-spacing="175" wx:if="{{ multiline }}" />
<input class="singleline-input" value="{{text}}" @input="onInput" placeholder="{{ placeholder }}" cursor-spacing="150" maxlength="{{ maxlength }}" wx:if="{{ !multiline }}" />
<textarea class="multiline-input" value="{{text}}" @input="onInput" placeholder="{{ placeholder }}" maxlength="{{ maxlength }}" cursor-spacing="175" wx:if="{{ multiline }}" />
<view class="cancel-container" @tap="onCancelTap">
<view class="cancel">{{ cancelText }}</view>
</view>
Expand Down Expand Up @@ -205,12 +205,8 @@ export default class InputBox extends wepy.component {
this.$apply();
},

// // 监听用户输入
// onInput(e) {
// this.text = e.detail.value;
// },

onBlur(e) {
// 监听用户输入
onInput(e) {
this.text = e.detail.value;
},

Expand Down
18 changes: 11 additions & 7 deletions client/src/pages/room-detail.wpy
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ input {
</view>
<view class="btn-area">
<button type="primary" @tap="onBackTap">{{t.back_button}}</button>
<button @tap="onDeleteTap">{{t.delete_button}}</button>
<button wx:if="{{room.isHost}}" @tap="onDeleteTap">{{t.delete_button}}</button>
</view>
</view>
<feedback></feedback>
Expand Down Expand Up @@ -205,11 +205,7 @@ export default class RoomDetail extends wepy.page {
});
},
onBackTap() {
if (getCurrentPages().length > 1) { // eslint-disable-line
wepy.navigateBack({ delta: 1 });
} else {
this.$redirect('index');
}
this.back();
},
async onDeleteTap() {
const { confirm } = await wepy.showModal({
Expand All @@ -227,7 +223,7 @@ export default class RoomDetail extends wepy.page {
});

if (result) {
this.onBackTap();
this.back();
}
}
};
Expand All @@ -245,5 +241,13 @@ export default class RoomDetail extends wepy.page {
});
this.$apply();
}

back() {
if (getCurrentPages().length > 1) { // eslint-disable-line
wepy.navigateBack({ delta: 1 });
} else {
this.$redirect('index');
}
}
}
</script>

0 comments on commit af9537b

Please sign in to comment.