[day14]Vue.js 网站基本建置

其实今年才刚学Vue.js ,目前的程度大概就是写几个简单的功能而已,要写一个比较完整的网站还是十分棘手的!期待透过这次铁人赛,可以建置一个稍微能看的社区支付网站罗!!

安装

安装vue之前,按照微软的建议可以先安装nvm-windows,主要是未来若开始开发,会需要在不同版本上开发,nvm则是可以进行版本控制,再多个版本之间切换,因为我本机没装,就不多做说明了,
而node.js 和 npm则是必要的,
直接到node.js网站下载安装,
https://ithelp.ithome.com.tw/upload/images/20210929/20140924Kqh4jWbCfp.png
安装完查询目前版本

node -v
>>> v15.14.0
npm -v
>>> 7.7.6

我自己习惯用yarn安装套件,所以我另外装了yarn

npm i -g yarn
yarn -v
>>> 1.22.10

接下来安装重头戏了,Vue CLI
Vue CLI

npm install -g @vue/cli
vue -V
>>> @vue/cli 4.5.12

建立专案

执行

vue create sinopacproj

依序设定,其中我原本设定为In dedicated config files,後来想想集中管理在package.json,可能是比较合适的作法。

Vue CLI v4.5.12
┌───────────────────────────────────────────┐
│                                           │
│   New version available 4.5.12 → 4.5.13   │
│     Run npm i -g @vue/cli to update!      │
│                                           │
└───────────────────────────────────────────┘

? Please pick a preset:
  Default ([Vue 2] babel, eslint)
  Default (Vue 3 Preview) ([Vue 3] babel, eslint) 
> Manually select features

? Please pick a preset: Manually select features
? Check the features needed for your project: 
>(*) Choose Vue version
 (*) Babel
 ( ) TypeScript
 ( ) Progressive Web App (PWA) Support        
 (*) Router
 (*) Vuex
 (*) CSS Pre-processors
 (*) Linter / Formatter
 ( ) Unit Testing
 ( ) E2E Testing

? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter
? Choose a version of Vue.js that you want to start the project with (Use arrow keys)
> 2.x
  3.x (Preview)


? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors, Linter
? Choose a version of Vue.js that you want to start the project with 2.x
? Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) Y
? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): 
> Sass/SCSS (with dart-sass)
  Sass/SCSS (with node-sass)
  Less
  Stylus


  ? Pick a linter / formatter config: 
> ESLint with error prevention only 
  ESLint + Airbnb config
  ESLint + Standard config
  ESLint + Prettier

? Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection)
>(*) Lint on save
 ( ) Lint and fix on commit


? Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys)
> In dedicated config files
  In package.json

? Save this as a preset for future projects? (y/N) N

安装完成,会呈现以下的画面

  • 设定资讯
    https://ithelp.ithome.com.tw/upload/images/20210929/20140924oHSmfDM0Tr.png
  • 安装完成
    https://ithelp.ithome.com.tw/upload/images/20210929/20140924F178ROm3of.png
  • 安装完成,出现以下提示
    https://ithelp.ithome.com.tw/upload/images/20210929/20140924Ns0tl1rg93.png

执行

cd sinopacproj
yarn serve

最原始的vue.js页面就完成罗
https://ithelp.ithome.com.tw/upload/images/20210929/20140924OoT9De3MEa.png

另外於这次铁人赛中,目前安装的套件执行语法如下:

yarn add axios
yarn add bootstrap-vue

之後有用到其他的,再另外说明罗

参考来源:

  • 微软

https://docs.microsoft.com/zh-tw/windows/dev-environment/javascript/nodejs-on-windows
https://docs.microsoft.com/zh-tw/windows/dev-environment/javascript/vue-on-windows

  • VUE教学

https://book.vue.tw/CH3/3-1-vue-cli-introduction.html


<<:  Day14-Machine Learning : Self-attention

>>:  Day15 互动式CSS按钮动画(下)

Day 19: 人工智慧初探 优化器的作用

Optimizer 优化器 神经网路是由多个神经元节点组成,每个神经元(Neuron)都拥有自己的权...

[Day21] 第二十一章 - 使用Ajax来做登入API界接

前言 昨天我们把登入页面套上了bootstrap 我们这次把jqury补上去 接者透过ajax做登入...

产品设计的孵化过程

在前一篇介绍了需求管理方式後,最终排序好需求的优先级就会带着排序最高的需求进到下一个环节-产品方案设...

微服务的应用程序-会话层是ISO OSI模型的服务程序(即sidecar代理)所属的层

-API 网关和服务网格(来源:Liran Katz) 服务网格(service mesh)是便於...

[Day14] swift & kotlin 实作篇!(5) 基本版面配置

swift 接下来~就让我们还拉一下版面吧 设定背景 首先点选左侧 Main.storyboard ...