fix: recover text wrap bug

This commit is contained in:
ShawnPhang 2024-02-01 14:37:10 +08:00
parent 88bde96ae9
commit 39c74895ef
2 changed files with 11 additions and 5 deletions

View File

@ -2,8 +2,8 @@
* @Author: ShawnPhang * @Author: ShawnPhang
* @Date: 2022-03-16 09:15:52 * @Date: 2022-03-16 09:15:52
* @Description: * @Description:
* @LastEditors: ShawnPhang * @LastEditors: ShawnPhang <https://m.palxp.cn>
* @LastEditTime: 2022-04-08 17:53:00 * @LastEditTime: 2024-01-31 15:43:10
--> -->
<template> <template>
<div ref="qrCodeDom" class="qrcode__wrap"></div> <div ref="qrCodeDom" class="qrcode__wrap"></div>
@ -46,7 +46,7 @@ export default defineComponent({
type: 'canvas' as DrawType, // canvas svg type: 'canvas' as DrawType, // canvas svg
data: props.value, data: props.value,
image: props.image, // /favicon.svg image: props.image, // /favicon.svg
margin: 2, margin: 0,
qrOptions: { qrOptions: {
typeNumber: 3 as TypeNumber, typeNumber: 3 as TypeNumber,
mode: 'Byte' as Mode, mode: 'Byte' as Mode,

View File

@ -54,7 +54,7 @@
const NAME = 'w-text' const NAME = 'w-text'
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
// import { fontWithDraw } from '@/utils/widgets/loadFontRule' import { fontWithDraw } from '@/utils/widgets/loadFontRule'
import getGradientOrImg from './getGradientOrImg.ts' import getGradientOrImg from './getGradientOrImg.ts'
export default { export default {
@ -107,7 +107,7 @@ export default {
computed: { computed: {
...mapGetters(['dActiveElement']), ...mapGetters(['dActiveElement']),
isDraw() { isDraw() {
return this.$route.name === 'Draw' // && fontWithDraw return this.$route.name === 'Draw' && fontWithDraw
}, },
}, },
watch: { watch: {
@ -121,6 +121,12 @@ export default {
const isDone = font.value === this.loadFontDone const isDone = font.value === this.loadFontDone
if (font.url && !isDone) { if (font.url && !isDone) {
if (font.id && this.isDraw) {
// url
// demobug
this.loading = false
return
}
this.loading = !this.isDraw this.loading = !this.isDraw
const loadFont = new window.FontFace(font.value, `url(${font.url})`) const loadFont = new window.FontFace(font.value, `url(${font.url})`)
await loadFont.load() await loadFont.load()