Β§2023-08-09
-γ試ι¨ζ©ε¨οΌ x8664Arch.yushei.com.tw, /opt/xfs/vue-proj
node --version
v20.4.0
[alexlai@x8664Arch vue-proj]$ which node
/usr/bin/node
[alexlai@x8664Arch vue-proj]$ which npm
/usr/bin/npm
[alexlai@x8664Arch vue-proj]$ npm --version
9.8.1
$ npm create vue@latest
Need to install the following packages:
create-vue@3.7.2
Ok to proceed? (y) y
Vue.js - The Progressive JavaScript Framework
β Project name: β¦ quickStart
β Package name: β¦ quickstart
β Add TypeScript? β¦ No / Yes
β Add JSX Support? β¦ No / Yes
β Add Vue Router for Single Page Application development? β¦ No / Yes
β Add Pinia for state management? β¦ No / Yes
β Add Vitest for Unit Testing? β¦ No / Yes
β Add an End-to-End Testing Solution? βΊ No
β Add ESLint for code quality? β¦ No / Yes
Scaffolding project in /opt/xfs/vue-proj/quickStart...
Done. Now run:
cd quickStart
npm install
npm run dev
$ tree quickStart/
quickStart/
βββ index.html
βββ package.json
βββ public
βΒ Β βββ favicon.ico
βββ README.md
βββ src
βΒ Β βββ App.vue
βΒ Β βββ assets
βΒ Β βΒ Β βββ base.css
βΒ Β βΒ Β βββ logo.svg
βΒ Β βΒ Β βββ main.css
βΒ Β βββ components
βΒ Β βΒ Β βββ HelloWorld.vue
βΒ Β βΒ Β βββ icons
βΒ Β βΒ Β βΒ Β βββ IconCommunity.vue
βΒ Β βΒ Β βΒ Β βββ IconDocumentation.vue
βΒ Β βΒ Β βΒ Β βββ IconEcosystem.vue
βΒ Β βΒ Β βΒ Β βββ IconSupport.vue
βΒ Β βΒ Β βΒ Β βββ IconTooling.vue
βΒ Β βΒ Β βββ TheWelcome.vue
βΒ Β βΒ Β βββ WelcomeItem.vue
βΒ Β βββ main.js
βββ vite.config.js
6 directories, 18 files
cd quickStart
$ npm install
$ npm run dev
VITE v4.4.9 ready in 1298 ms
β Local: http://localhost:5173/
β Network: use --host to expose
β press h to show help
Shortcuts
press r to restart the server
press u to show server url
press o to open in browser
press c to clear console
press q to quit
Note that the example components in the generated project are written using the Composition API and , rather than the Options API.
In simple terms, the Options API is like using predefined sections to write your component, while the Composition API is like assembling smaller, reusable functions to build your component's behavior in a more flexible way. Both approaches have their merits, and you can choose the one that fits your project and coding style best.
$ npm run build
> quickstart@0.0.0 build
> vite build
vite v4.4.9 building for production...
β 23 modules transformed.
dist/assets/logo-277e0e97.svg 0.28 kB β gzip: 0.20 kB
dist/index.html 0.42 kB β gzip: 0.28 kB
dist/assets/index-ef4f98ff.css 3.69 kB β gzip: 1.19 kB
dist/assets/index-393e57c5.js 60.05 kB β gzip: 23.86 kB
β built in 3.96s
$ tree dist
dist
βββ assets
βΒ Β βββ index-393e57c5.js
βΒ Β βββ index-ef4f98ff.css
βΒ Β βββ logo-277e0e97.svg
βββ favicon.ico
βββ index.html
$ sudo npm install -g serve
$ which serve
/usr/bin/serve
$ cd dist/
$ serve
βββββββββββββββββββββββββββββββββββββββββββββ
β β
β Serving! β
β β
β - Local: http://localhost:3000 β
β - Network: http://192.168.2.132:3000 β
β β
β Copied local address to clipboard! β
β β
βββββββββββββββββββββββββββββββββββββββββββββ
Here are some additional tips:
Return to Top