Nuxt3で$refsを使うと思ったら、うまくいかなかった。。
Composition APIで$refsは使えないらしい。。
Composition APIでのテンプレート参照したいときは、
refと同じ変数をRefを使って用意すればよいらしい。
<script setup> const myCoolDiv = ref(null) const clickMe = () => console.log(myCoolDiv) </script> <template> <button @click="clickMe">show me the ref</button> <div ref="myCoolDiv">hello there</div> </template>
また、カスタムコンポーネント内の関数などを呼びたいときは、
defineExposeを使って、明示的に公開する必要がある。
以上!!