* vite是什么?
* 一个前端的开发构建工具
* 当我们的项目组件变大时,会自觉的分文件、分组件等操作,缩减单文件的大小、增加可维护性,vite则可以帮我们管理,并且它有很多插件帮助我们开发。
目录
初始化
- 创建一个文件夹,比如这里创建一个叫 mimicrymusic 的文件夹:
- 然后进入这个文件夹,或是把它拖进vscode中:
- 可以进VSCode内,使用终端运行以下命令:
- 初始化生成包配置文件:npm init -y
- 生成package.json:
- -
- 内容如下:
- -
- 其中:
- name:项目名
- version:版本号
- description:项目描述
- main:js入口
- scripts:配置用于npm的命令
- keywords:(可以不要)
- author:作者信息(可以不要)
- license:开源协议
安装vite依赖
- 在终端中执行命令:npm i vite -D
- 安装vite的开发环境依赖:
- 等待一段时间的下载:
- 下载完成后我们刚刚的包配置文件package.json中就会有自动增加一个vite的依赖:
安装vue的依赖
- 在终端中执行命令:npm i vue
- 等待安装完成以后,package.json中就会自动增加vue的配置:
创建index.html
- 在项目的根位置,即和package.json同级的位置创建一个index.html文件:
- 里面写如下内容:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>标题</title>
</head>
<body>
<!-- 引用的js文件位置 -->
<script type="module" src=""></script>
</body>
</html>
- 正如上面代码中注释所说,script标签引入了一个js文件到index.html,但我们还没有指定引入哪一个js文件,下面我们将创建这个文件,然后在引入。
创建main.js
- 在项目根位置创建src目录,然后在src内创建main.js文件:
- 里面我们可以先随便写一句输出: console.log("hello coolight");
- 保存文件
- 在我们刚刚的index.html中引入main.js文件:
<!-- 引用的js文件 -->
<script type="module" src="./src/main.js"></script>
- 在package.json中配置npm命令,即把里面的scripts的内容改为 "dev" : "vite"
尝试让它跑起来(1)
- 在终端中敲 npm run dev,就会有如下信息提示
- 键盘按住ctrl,然后鼠标左键点击终端里图中框起来的链接(不要点我的图,点你的终端里的!!!):
- 它就会跳转到浏览器,显示我们刚刚写的页面
- 一片空白则是正常的,因为我们的页面并没有写东西
- 我们的js也只写了一句输出,这时候要在浏览器中打开控制台看看有没有这句输出
- 浏览器中来到我们写的页面
- 在浏览器中按一下键盘F12键
- 浏览器就会弹出一个窗口:
- 此时点击控制台,就可以看见我们的main.js的输出了:
创建App.vue
- 在src目录下,新建 App.vue 文件:
- 内容可以随便写点,比如:
<template>
<div>
你好 coolight
</div>
</template>
在main.js中创建vue,安装vitejs
- 修改main.js的内容为:
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
app.mount('#app')
- 可以看到,我们在main.js中创建的vue需要一个挂载点,在html中一个id为 app 的元素
- 所以我们需要在index.html中增加一个 <div id="app"></div> :
- 保存文件
- 此时你可能发现,欸vite好像报错了:
- [vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
- 浏览器里我们的页面也有报错:
- 它的意思很明显,需要我们去安装 @vitejs/plugin-vue,因为浏览器正常执行不了vue文件,所以需要安装插件来编译解析。
- 那么我们就来安装它。
- 如果你的终端vite还在运行,也就是没有显示提示让你输入,就像这样:
- 那么就按键盘ctrl + c ,停止掉vite
- 它会问你 终止批处理操作吗(Y/N)?
- 我们输入 y ,然后回车即可
- 然后再输入 npm i @vitejs/plugin-vue -D
- 等待下载安装:
- 然后在项目根目录创建vite的配置文件:vite.config.js
- 里面写如下配置:
import { defineConfig } from "vite"
import Vue from "@vitejs/plugin-vue"
export default defineConfig({
plugins:[
Vue()
]
})
- 保存文件
- 在终端中执行 npm run dev
- 然后回到浏览器中看看我们的页面,就会发现已经正常了!
结语
- 这个是手动配置的方法,其实有很简单的一键操作。
- 后面我们聊聊给手动配置路由router,状态管理pinia等
https://praktikaucheba.ru/
casino tr?c tuy?n vi?t nam casino online uy tin casino tr?c tuy?n vi?t nam
https://praktikaotchet.ru/
https://casinvietnam.com/# casino tr?c tuy?n uy tin
Журнал для женщин http://womangu.ru/ – актуальные новости о звездах и шоу-бизнесе, модные тенденции, статьи об отношениях, красоте и здоровье, рецепты и каталог диет на женском портале.
buy glyburide for sale – buy glipizide 5mg online where can i buy forxiga
http://casinvietnam.com/# casino tr?c tuy?n vi?t nam
casino tr?c tuy?n casino tr?c tuy?n danh bai tr?c tuy?n
casino tr?c tuy?n vi?t nam casino tr?c tuy?n vi?t nam web c? b?c online uy tin
The calculator on a smartphone is very constrained in functions. As an architect, I often require a scientific online calculator, such as this https://calculator-online.info/. It is effective for various tasks like financial calculations, percentage calculations, solving complex equations, finding square and cube roots, and more
Когда я выбирал компанию для поискового продвижения компанию для SEO-продвижения сайта своего стартапа, мой выбор остановился на https://seo-best1.ru. Их личное внимание к клиенту и глубокий анализ ниши превзошли все ожидания. Рост позиций в поисковой выдаче заметен уже через месяц работы, а трафик на сайт увеличился значительно. Рекомендую как надежного партнера в SEO-продвижении!
https://casinvietnam.shop/# danh bai tr?c tuy?n
casino online uy tin casino online uy tin casino tr?c tuy?n
PBN sites
We will build a structure of privately-owned blog network sites!
Pros of our self-owned blog network:
We execute everything so google doesn’t comprehend THAT THIS IS A private blog network!!!
1- We obtain domain names from distinct registrars
2- The primary site is hosted on a virtual private server (VPS is fast hosting)
3- Other sites are on various hostings
4- We designate a unique Google ID to each site with verification in Search Console.
5- We develop websites on WordPress, we do not utilize plugins with assisted by which malware penetrate and through which pages on your websites are established.
6- We refrain from repeat templates and utilize only distinct text and pictures
We refrain from work with website design; the client, if wished, can then edit the websites to suit his wishes
Каталог салонов эпиляции https://findepil.ru/ Москвы и Московской области. Химки, Люберцы, Красногорск, Зеленоград и т.д. Все виды эпиляции – электроэпиляция, депиляция воском, шугаринг, лазерная эпиляция. Можно выбрать салон по цене, для примера выбраны стандартные процедуры эпиляции – руки воск, ноги шугаринг. Каталог постоянно пополняется.
https://medicationnoprescription.pro/# non prescription online pharmacy india
http://medicationnoprescription.pro/# п»їonline pharmacy no prescription needed
canadian online pharmacy no prescription canadian pharmacy coupon code cheapest pharmacy for prescriptions without insurance
http://medicationnoprescription.pro/# buying online prescription drugs
synthroid vyvanse
buy metformin – order glycomet 500mg sale generic acarbose 25mg
https://onlinepharmacyworld.shop/# overseas pharmacy no prescription
order ed pills: buy ed medication – ed online prescription
http://medicationnoprescription.pro/# canadian prescription drugstore reviews
drugstore com online pharmacy prescription drugs canadian pharmacy world coupons canadian online pharmacy no prescription
После того как мой сайт потерял видимость в поисковых системах, обратился в seo-prodvijenie-saytov. Результат не заставил себя ждать: трафик вырос, а вместе с ним и продажи. Команда профессионально подошла к задаче, улучшили структуру и контент. Рекомендую!
overseas pharmacy no prescription: prescription drugs online – canada drugs coupon code
http://medicationnoprescription.pro/# best online pharmacies without prescription
Если вы ищете надежный сервис по обслуживанию холодильников Whirlpool в российской столице, то вы пришли по правильному адресу. Наш техцентр специализируется на восстановлении холодильного оборудования данной марки и имеет значительный опыт в данной сфере. Мы обеспечиваем отменное качество услуг, использование оригинальных деталей и умеренные тарифы. Позвоните с нами без промедления, и мы окажем помощь вашему устройству Whirlpool снова заработать на все 100%! Для получения дополнительной информации посетите taplink.cc.
http://edpill.top/# affordable ed medication
online pharmacy no prescription: canadian pharmacy world coupons – canadian online pharmacy no prescription
order desloratadine 5mg without prescription – flixotide over the counter ventolin inhaler
cheapest ed online how to get ed meds online buy ed meds online
Нужно было повысить видимость своего сайта в поисковиках, я обратился в seo-prodvijenie-saytov.ru. Специалисты провели грамотный аудит, подобрали ключевые слова и провели оптимизацию содержания сайта. Уже через месяц трафик увеличился, а клиенты стали активнее делать заказы. Рекомендую!
buy ed meds online: cheapest ed medication – buy ed pills online
http://edpill.top/# cheap erectile dysfunction pills
Jeetwin Affiliate
Jeetwin Affiliate
Join Jeetwin now! | Jeetwin sign up for a ?500 free bonus
Spin & fish with Jeetwin club! | 200% welcome bonus
Bet on horse racing, get a 50% bonus! | Deposit at Jeetwin live for rewards
#JeetwinAffiliate
Casino table fun at Jeetwin casino login | 50% deposit bonus on table games
Earn Jeetwin points and credits, enhance your play!
https://www.jeetwin-affiliate.com/hi
#JeetwinAffiliate #jeetwinclub #jeetwinsignup #jeetwinresult
#jeetwinlive #jeetwinbangladesh #jeetwincasinologin
Daily recharge bonuses at Jeetwin Bangladesh!
25% recharge bonus on casino games at jeetwin result
15% bonus on Crash Games with Jeetwin affiliate!
Turn to Win Actual Money and Voucher Codes with JeetWin’s Partner Program
Are you a fan of internet gaming? Do you actually like the adrenaline rush of rotating the spinner and triumphing big-time? If so, therefore the JeetWin’s Partner Program is great for you! With JeetWin Casino, you not just get to experience enthralling games but as well have the likelihood to generate actual money and voucher codes just by endorsing the platform to your friends, family, or digital audience.
How Does it Work?
Joining for the JeetWin’s Partner Program is quick and effortless. Once you grow into an associate, you’ll acquire a distinctive referral link that you can share with others. Every time someone joins or makes a deposit using your referral link, you’ll earn a commission for their activity.
Fantastic Bonuses Await!
As a JeetWin affiliate, you’ll have access to a selection of appealing bonuses:
Sign Up Bonus 500: Receive a bountiful sign-up bonus of INR 500 just for joining the program.
Welcome Deposit Bonus: Enjoy a huge 200% bonus when you deposit and play slot machine and fishing games on the platform.
Endless Referral Bonus: Receive unlimited INR 200 bonuses and cash rebates for every friend you invite to play on JeetWin.
Thrilling Games to Play
JeetWin offers a broad range of the most played and most popular games, including Baccarat, Dice, Liveshow, Slot, Fishing, and Sabong. Whether you’re a fan of classic casino games or prefer something more modern and interactive, JeetWin has something for everyone.
Engage in the Greatest Gaming Experience
With JeetWin Live, you can enhance your gaming experience to the next level. Engage in thrilling live games such as Lightning Roulette, Lightning Dice, Crazytime, and more. Sign up today and embark on an unforgettable gaming adventure filled with excitement and limitless opportunities to win.
Simple Payment Methods
Depositing funds and withdrawing your winnings on JeetWin is speedy and hassle-free. Choose from a variety of payment methods, including E-Wallets, Net Banking, AstroPay, and RupeeO, for seamless transactions.
Don’t Lose on Exclusive Promotions
As a JeetWin affiliate, you’ll receive access to exclusive promotions and special offers designed to maximize your earnings. From cash rebates to lucrative bonuses, there’s always something exciting happening at JeetWin.
Get the App
Take the fun with you wherever you go by downloading the JeetWin Mobile Casino App. Available for both iOS and Android devices, the app features a wide range of entertaining games that you can enjoy anytime, anywhere.
Join the JeetWin Affiliate Program Today!
Don’t wait any longer to start earning real cash and exciting rewards with the JeetWin Affiliate Program. Sign up now and be a member of the thriving online gaming community at JeetWin.
online blackjack for real money in kenya https://www.casinoonline.co.ke .
https://medicationnoprescription.pro/# order medication without prescription
https://medicationnoprescription.pro/# best no prescription online pharmacy
http://edpill.top/# ed online pharmacy
online meds no prescription canada prescription online buy medication online no prescription
legitimate online pharmacy no prescription: buy medications without a prescription – overseas online pharmacy-no prescription
http://onlinepharmacyworld.shop/# no prescription pharmacy paypal
https://kursovuyupishem.ru/
low cost ed medication pills for ed online ed medications online
canadian pharmacy coupon: international pharmacy no prescription – best online pharmacy no prescription
Услуга по сносу старых зданий и утилизации отходов в Москве и Московской области. Мы предоставляем услуги по сносу старых сооружений и удалению мусора на территории Москвы и Московской области. Услуга демонтаж дома под ключ выполняется квалифицированными специалистами в течение 24 часов после оформления заказа. Перед началом работ наш эксперт бесплатно посещает объект для определения объёма работ и предоставления консультаций. Чтобы получить дополнительную информацию и рассчитать стоимость услуг, свяжитесь с нами по телефону или оставьте заявку на сайте компании.
http://edpill.top/# buying erectile dysfunction pills online
http://edpill.top/# cheap ed drugs