QRCode.vue 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="content">
  3. <view class="qrcode">
  4. <uqrcode ref="uqrcode"></uqrcode>
  5. <view class="qrcode-text">客户扫码</view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import {
  11. mapState
  12. } from 'vuex';
  13. export default {
  14. data() {
  15. return {
  16. };
  17. },
  18. onReady() {
  19. console.log(this.userInfo)
  20. this.$refs
  21. .uqrcode
  22. .make({
  23. size: 300,
  24. margin:50,
  25. text: JSON.stringify(this.userInfo.userName)
  26. })
  27. .then(res => {
  28. // 返回的res与uni.canvasToTempFilePath返回一致
  29. console.log(res)
  30. })
  31. },
  32. computed: {
  33. ...mapState(['hasLogin', 'userInfo'])
  34. },
  35. methods: {}
  36. }
  37. </script>
  38. <style lang="scss">
  39. .content{
  40. background: rgba(0, 0, 0, 0.4);
  41. height: 100vh;
  42. display: flex;
  43. justify-content: center;
  44. align-items: center;
  45. }
  46. .qrcode-text{
  47. text-align: center;
  48. position: relative;
  49. font-size: 24rpx;
  50. font-weight: 400;
  51. color: #878C9C;
  52. top: -60rpx;
  53. }
  54. // .qrcode{
  55. // position: absolute;
  56. // top: 0;
  57. // }
  58. </style>