migrate switch to mobile dialog to composition API and typescript

This commit is contained in:
MaysWind
2025-01-05 17:07:46 +08:00
parent 454e97c9f1
commit 7c40157cba
+20 -23
View File
@@ -28,34 +28,31 @@
</v-dialog> </v-dialog>
</template> </template>
<script> <script setup lang="ts">
import { computed } from 'vue';
import { getMobileUrlQrCodePath } from '@/lib/qrcode.ts'; import { getMobileUrlQrCodePath } from '@/lib/qrcode.ts';
import { getMobileVersionPath } from '@/lib/version.ts'; import { getMobileVersionPath } from '@/lib/version.ts';
export default { const props = defineProps<{
props: [ show: boolean;
'show' }>();
],
emits: [ const emit = defineEmits<{
'update:show' (e: 'update:show', value: boolean): void
], }>();
data() {
return { const mobileUrlQrCodePath = getMobileUrlQrCodePath();
mobileUrlQrCodePath: getMobileUrlQrCodePath(), const mobileVersionPath = getMobileVersionPath();
mobileVersionPath: getMobileVersionPath(),
} const showState = computed<boolean>({
get: () => {
return props.show;
}, },
computed: { set: value => {
showState: { emit('update:show', value);
get: function () {
return this.show;
},
set: function (value) {
this.$emit('update:show', value);
}
}
} }
} });
</script> </script>
<style> <style>