qrcodeed.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div style="height:50vh;">
  3. <div id="qrcode" ref="qrcode" style="margin-top:25vh;"></div>
  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. methods: {
  24. qrcode() {
  25. console.log(this.formData.changJingId)
  26. let qrcode = new QRCode('qrcode', {
  27. width: 132,
  28. height: 132,
  29. 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`,
  30. //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`,
  31. colorDark: "#000000", //前景色
  32. colorLight: "#FFFFFF", //背景色
  33. correctLevel: QRCode.CorrectLevel.L,
  34. })
  35. },
  36. },
  37. mounted() {
  38. let this_ = this;
  39. console.log(QRCode)
  40. this.$nextTick(() => {
  41. setTimeout(() => {
  42. this_.qrcode();
  43. }, 0)
  44. })
  45. },
  46. }
  47. </script>
  48. <style scoped>
  49. #qrcode {
  50. width: 100px;
  51. height: 100px;
  52. }
  53. </style>