qrcodeed.vue 1.0 KB

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