單文件組件


1. 什么是單文件組件:

把一個組件全部內容匯合到一個文件中,文件名字是以 .vue 結尾的就稱作 vue單文件組件

2. 最簡單使用

  • 通過Vuecli創建一個空的項目並運行
  • 創建單文件組件 src/component/01.單文件組件.vue
  • src/main.js 文件中導入、注冊組件
  • public/index.html 文件 使用 單文件組件

3. 組織結構

<template>
  相關html標簽
</template>

<script>
  export default {
    data,
    methods,
    computed,
    filters,
    created,
    ……
  }
</script>

<style>
  css樣式內容
</style>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM