0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Vue CLIによって作られたファイルを見ていく(src編)

Last updated at Posted at 2023-03-19

環境構築でVue CLIによって作られたファイルを見ていく(src周り)
やりたいことリスト

src周りを見ていく

現状どんな構成になっているのかを知る

index.html

image.png
langはjpに変えてます。
headは飛ばして、bodyには、id'app'のdiv要素とmain.tsが入っている

main.ts

image.png
・createAppでVueインスタンスを作成
・registerPluginsでプラグインの設定(vuetify, router, pinia)
・Vueインスタンスをid'app'にマウント
といった流れのよう

createAppはvue3からのもので、これまではnew Vueで行っていたもの
Appは同階層にあるApp.vue
registerPluginsは.src/plugins/index.ts
からそれぞれインポートしている

mountもvue3で$mountから$がつかなくなったみたい

App.vue

router-vueタグのみ
image.png

index.ts

registerPlugins関数を作成して、引数で渡されたVueappに対して、フォントやプラグインを適用する
image.png

loadFonts

loadFontsは、webfontloaderを使用して、GoogleフォントのRobotoを読み込んでいる(src\plugins\webfontloader.ts)
image.png

vuetify

image.png

router

Home.vueがインポートされている
ここから作成したページに遷移できるようにしているっぽい
image.png

pinia

image.png

Home.vue

コンポーネントのHelloWorldをインポートして出力
image.png

HolloWorld

念願のHelloWorld
コンポーネント化しているため、インポートしてで表示できる
image.png

終わり

ちょっと座学に飽きたのでいったん終わり
さっさと開発したい

気が向いたら深掘ります!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?