qrcodeed.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <div style="height:50vh;">
  3. <div id="qrcode" ref="qrcode" style="margin-top:25vh;" />
  4. </div>
  5. </template>
  6. <script>
  7. import QRCode from 'qrcodejs2' // 引入qrcode
  8. export default {
  9. name: 'qrcode',
  10. props: {
  11. field: Object,
  12. formData: {
  13. type: Object,
  14. default () {
  15. return {}
  16. }
  17. },
  18. readonly: {
  19. type: Boolean,
  20. default: false
  21. }
  22. },
  23. mounted () {
  24. this.qrcode()
  25. },
  26. methods: {
  27. qrcode () {
  28. console.log(this)
  29. const qrcode = new QRCode('qrcode', {
  30. width: 132,
  31. height: 132,
  32. text: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf0aecf99696061a3&redirect_uri=https%3A%2F%2Fwww.szjyxt.com%2F%23%2Fziliao&response_type=code&scope=snsapi_base&state=${this.formData.changJingId}#wechat_redirect`,
  33. // text: `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxea2c214ca5d25739&redirect_uri=https%3A%2F%2Fwww.szjyxt.com%2F%23%2Fziliao&response_type=code&scope=snsapi_base&state=${this.formData.changJingId}#wechat_redirect`,
  34. colorDark: '#000000', // 前景色
  35. colorLight: '#FFFFFF', // 背景色
  36. correctLevel: QRCode.CorrectLevel.L
  37. })
  38. }
  39. }
  40. }
  41. </script>
  42. <style scoped>
  43. #qrcode {
  44. width: 100px;
  45. height: 100px;
  46. }
  47. </style>