[Vuejs]-How do you "translate" this into <script setup>?

1👍

<template>
  <button @click="scrollToElement()">
    Scroll to el
  </button>
  ...
  <div ref="section">
    <p>something</p>
  </div>
  ...
</template>

<script setup>
  import { ref } from "vue";

  const section = ref();

  const scrollToElement = () => {
    section.value.scrollIntoView({ behavior: "smooth" });
  }
</script>

Leave a comment