saoma.vue 562 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <view>
  3. <input class="input" type="text" v-model="date" />
  4. <button type="primary" @click="tel()">扫描</button>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. data() {
  10. return {
  11. date: 0,
  12. };
  13. },
  14. methods:{
  15. tel(){
  16. var that = this;
  17. // 允许从相机和相册扫码
  18. uni.scanCode({
  19. success(res) {
  20. console.log('条码类型:' + res.scanType);
  21. console.log('条码内容:' + res.result);
  22. that.date = res.result;
  23. }
  24. });
  25. },
  26. }
  27. }
  28. </script>
  29. <style>
  30. </style>