JavaScript/vue.js/ref:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第39行: 第39行:


== 函数 ==
== 函数 ==
<syntaxhighlight lang="html5">
<template>
  <div ref="update">Hello, Vue 3 with TypeScript!</div>
</template>
<script lang="ts" setup>
import { ref, ComponentPublicInstance, HTMLAttributes } from 'vue';
...
const update = (el: HTMLElement | ComponentPublicInstance | HTMLAttributes) => {
  console.log(el);
};
...
</script></syntaxhighlight>