- 源码: xhadmincn/FastMovieAI (Apache 2.0) - 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION - vendor/示例资源已gitignore
25 lines
607 B
Vue
25 lines
607 B
Vue
<script lang="ts" setup>
|
|
import QRCode from "qrcode";
|
|
const props = withDefaults(defineProps<{
|
|
text?: string
|
|
size?: number
|
|
}>(), {
|
|
size: 200
|
|
});
|
|
const emit = defineEmits(['update'])
|
|
const qrcode = ref('');
|
|
watchEffect(() => {
|
|
qrcode.value = '';
|
|
if (props.text) {
|
|
QRCode.toDataURL(props.text, {
|
|
width: props.size
|
|
}, (_error: Error | null | undefined, url: string) => {
|
|
qrcode.value = url
|
|
emit('update');
|
|
});
|
|
}
|
|
})
|
|
</script>
|
|
<template>
|
|
<el-image v-if="qrcode" :src="qrcode" style="width: 100%;height: 100%;" />
|
|
</template> |