• Vue3 <script setup lang=“ts“> 使用指南


    本文主要是讲解 x

  • 1.2. 优势

    与组件选项 setup 函数对比, 

  • <template>
  • <h1>{{ msg }}h1>
  • <button type="button" @click="add">count is: {{ count }}button>
  • template>
  • 若需要使用 TypeScript,则将 lang 属性添加到 

  • <template>
  • <h1>{{ msg }}h1>
  • <button type="button" @click="add">count is: {{ count }}button>
  • template>
  • <template>
  • <h1>{{ msg }}h1>
  • <h1>{{ getToken() }}h1>
  • <button type="button" @click="add">count is: {{ count }}button>
  • <ComponentA />
  • template>
  • 注意: