自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

一篇帶給你Vite 功能概覽

開發(fā) 開發(fā)工具
對非?;A的使用來說,使用 Vite 開發(fā)和使用一個靜態(tài)文件服務器并沒有太大區(qū)別。然而,Vite 還通過原生 ESM 導入提供了許多主要用于打包場景的增強功能。

[[406618]]

Vite 功能概覽

功能| https://cn.vitejs.dev/guide/features.html

CSS 支持

CSS Modules

  1. .red{ 
  2.   color: rosybrown; 

\src\components\Css.vue:

  1. <template> 
  2.   <hr /> 
  3.   <h2>CSS支持</h2> 
  4.   <pclass="red">引入外部CSS文件</p> 
  5.   <pclass="bule">自己的 CSS 代碼</p> 
  6. </template> 
  7.  
  8. <script> 
  9. export default {}; 
  10. </script> 
  11.  
  12. <style> 
  13. @import ". 
  14. ./assets/style" ; 
  15. .bule { 
  16.   color: blue; 
  17. </style> 

sass預處理器

Vite 也同時提供了對 .scss, .sass, .less, .styl 和 .stylus 文件的內置支持。沒有必要為他們安裝特定的 vite 插件,但相應的預處理器依賴本身必須安裝:

src\assets\style.sass:

  1. $bg: red 
  2. .li 
  3.   color: $bg 

src\components\Users.vue:

  1. <stylelang="sass"
  2. // 導入 CSS(sass) 文件 
  3. @import'../assets/style' 
  4. $blues: blue 
  5. ul 
  6.   li 
  7.     color: $blues 
  8. .lis 
  9.   color: $blues 
  10. </style> 

JSON

JSON 可以被直接導入 - 同樣支持具名導入:

  1. <template> 
  2.   <hr /> 
  3.   <h2>CSS支持</h2> 
  4.   <pclass="red">引入外部CSS文件</p> 
  5.   <pclass="bule">自己的 CSS 代碼</p> 
  6.   <h3>獲取 json 文件數據:</h3> 
  7.   <pv-for=" i in users" :key="i.id"
  8.     {{i.username}} 
  9.   </p> 
  10. </template> 
  11.  
  12. <script> 
  13. import datas from '../assets/data.json' 
  14. export default { 
  15.   data(){ 
  16.     return { 
  17.      users:datas 
  18.     } 
  19.   }, 
  20.   mounted(){ 
  21.    console.log(datas) 
  22.   } 
  23. }; 
  24. </script> 
  25.  
  26. <style> 
  27. @import "../assets/style" ; 
  28. .bule { 
  29.   color: blue; 
  30. </style> 

路由

安裝路由模塊

  1. npm install vue-router@4 

\src\main.js:

  1. import {createApp } from'vue' 
  2. import App from'./App.vue' 
  3. import router from'./router' 
  4.  
  5. createApp(App) 
  6. .use(router) 
  7. .mount('#app'

\src\router\index.js:

  1. import  { createRouter, createWebHistory }  from'vue-router' 
  2. import Hello from'../components/HelloWorld.vue' 
  3.  
  4. const routes = [ 
  5.   { 
  6.     path:'/'
  7.     name:'Hello'
  8.     component: Hello 
  9.   }, 
  10.   { 
  11.     path:'/about'
  12.     name:'About'
  13.     component: () =>import('../components/About.vue'
  14.   } 
  15.  
  16. exportdefaultcreateRouter({ 
  17.   history:createWebHistory(), 
  18.   routes 
  19. }) 

\src\App.vue

  1. <template> 
  2.   <imgalt="Vue logo" src="./assets/logo.png" /> 
  3.  <router-view/> 
  4. </template> 

配置選項

  1. npm install element-plus --save 

 

責任編輯:姜華 來源: 勾勾的前端世界
相關推薦

2021-07-12 06:11:14

SkyWalking 儀表板UI篇

2022-03-02 08:52:49

PostmangRPCAPI調試

2021-07-21 09:48:20

etcd-wal模塊解析數據庫

2022-03-22 09:09:17

HookReact前端

2021-01-28 08:55:48

Elasticsear數據庫數據存儲

2021-04-01 10:51:55

MySQL鎖機制數據庫

2021-04-14 14:16:58

HttpHttp協議網絡協議

2022-04-29 14:38:49

class文件結構分析

2023-03-29 07:45:58

VS編輯區(qū)編程工具

2021-03-12 09:21:31

MySQL數據庫邏輯架構

2024-06-13 08:34:48

2022-02-17 08:53:38

ElasticSea集群部署

2021-04-08 11:00:56

CountDownLaJava進階開發(fā)

2022-02-25 15:50:05

OpenHarmonToggle組件鴻蒙

2021-04-14 07:55:45

Swift 協議Protocol

2021-07-08 07:30:13

Webpack 前端Tree shakin

2023-03-13 09:31:04

2021-05-08 08:36:40

ObjectString前端

2021-10-28 08:51:53

GPIO軟件框架 Linux

2021-04-23 08:59:35

ClickHouse集群搭建數據庫
點贊
收藏

51CTO技術棧公眾號