Skip to content

Commit f1d399a

Browse files
committed
style: scanCode demo
1 parent c85d8a5 commit f1d399a

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pages/API/scan-code/scan-code.vue

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
<view>
33
<page-head :title="title"></page-head>
44
<view class="uni-padding-wrap uni-common-mt">
5-
<view class="uni-title">扫码结果</view>
6-
<view class="uni-list">
5+
<view class="uni-title">扫码结果</view>
6+
<view class="uni-list" v-if="result">
77
<view class="uni-cell">
8-
<view class="uni-input">{{result}}</view>
8+
<view class="scan-result">
9+
{{result}}
10+
</view>
911
</view>
1012
</view>
1113
<view class="uni-btn-v">
12-
<button type="primary" @tap="scanCode">扫一扫</button>
14+
<button type="primary" @click="scan">扫一扫</button>
1315
</view>
1416
</view>
1517
</view>
@@ -22,23 +24,21 @@
2224
result: ''
2325
}
2426
},
25-
onUnload:function(){
26-
this.result = '';
27-
},
2827
methods: {
29-
scanCode: function () {
30-
var that = this
28+
scan: function() {
3129
uni.scanCode({
32-
success: function (res) {
33-
that.result = res.result
34-
},
35-
fail: function (res) {}
36-
})
30+
success: (res) => {
31+
this.result = res.result
32+
}
33+
});
3734
}
3835
}
3936
}
4037
</script>
4138

4239
<style>
43-
44-
</style>
40+
.scan-result {
41+
min-height: 50upx;
42+
line-height: 50upx;
43+
}
44+
</style>

0 commit comments

Comments
 (0)