perf(client): use shallowRef for html element ref

This commit is contained in:
syuilo
2023-01-03 10:12:37 +09:00
parent a0af80f8c5
commit 2184240ef1
59 changed files with 114 additions and 115 deletions

View File

@ -5,7 +5,7 @@
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, reactive, ref } from 'vue';
import { onMounted, onUnmounted, reactive, ref, shallowRef } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import { GetFormResultType } from '@/scripts/form';
@ -32,7 +32,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit,
);
const live2d = ref<HTMLIFrameElement>();
const live2d = shallowRef<HTMLIFrameElement>();
const touched = () => {
//if (this.live2d) this.live2d.changeExpression('gurugurume');

View File

@ -12,7 +12,7 @@
</template>
<script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
import { nextTick, onMounted, onUnmounted, reactive, ref, shallowRef } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import { GetFormResultType } from '@/scripts/form';
import * as os from '@/os';
@ -49,8 +49,8 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
const images = ref([]);
const fetching = ref(true);
const slideA = ref<HTMLElement>();
const slideB = ref<HTMLElement>();
const slideA = shallowRef<HTMLElement>();
const slideB = shallowRef<HTMLElement>();
const change = () => {
if (images.value.length === 0) return;