From 7c9bdfe8f8c423e780c9c1be5fa454f4d05fb2c0 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Mon, 25 Oct 2021 09:19:49 -0500 Subject: [PATCH] web: Add vue router. --- web/.eslintrc.js | 14 ++++++------- web/package-lock.json | 19 ++++++++++++------ web/package.json | 8 +++++--- web/src/App.vue | 33 +++++++++++++++++-------------- web/src/components/HelloWorld.vue | 4 ++-- web/src/main.ts | 7 ++++--- web/src/router/index.ts | 26 ++++++++++++++++++++++++ web/src/views/About.vue | 5 +++++ web/src/views/Home.vue | 18 +++++++++++++++++ 9 files changed, 98 insertions(+), 36 deletions(-) create mode 100644 web/src/router/index.ts create mode 100644 web/src/views/About.vue create mode 100644 web/src/views/Home.vue diff --git a/web/.eslintrc.js b/web/.eslintrc.js index add9b49..b6fb9d7 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -4,17 +4,17 @@ module.exports = { node: true, }, extends: [ - "plugin:vue/vue3-essential", - "eslint:recommended", - "@vue/typescript/recommended", - "@vue/prettier", - "@vue/prettier/@typescript-eslint", + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/typescript/recommended', + '@vue/prettier', + '@vue/prettier/@typescript-eslint', ], parserOptions: { ecmaVersion: 2020, }, rules: { - "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", - "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', }, }; diff --git a/web/package-lock.json b/web/package-lock.json index 25bc004..c0c3842 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1091,6 +1091,11 @@ } } }, + "@vue/devtools-api": { + "version": "6.0.0-beta.19", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.0.0-beta.19.tgz", + "integrity": "sha512-ObzQhgkoVeoyKv+e8+tB/jQBL2smtk/NmC9OmFK8UqdDpoOdv/Kf9pyDWL+IFyM7qLD2C75rszJujvGSPSpGlw==" + }, "@vue/eslint-config-prettier": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz", @@ -9066,12 +9071,6 @@ "send": "0.17.1" } }, - "servor": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/servor/-/servor-4.0.2.tgz", - "integrity": "sha512-MlmQ5Ntv4jDYUN060x/KEmN7emvIqKMZ9OkM+nY8Bf2+KkyLmGsTqWLyAN2cZr5oESAcH00UanUyyrlS1LRjFw==", - "dev": true - }, "set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -10755,6 +10754,14 @@ } } }, + "vue-router": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.0.12.tgz", + "integrity": "sha512-CPXvfqe+mZLB1kBWssssTiWg4EQERyqJZes7USiqfW9B5N2x+nHlnsM1D3b5CaJ6qgCvMmYJnz+G0iWjNCvXrg==", + "requires": { + "@vue/devtools-api": "^6.0.0-beta.18" + } + }, "vue-style-loader": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz", diff --git a/web/package.json b/web/package.json index 05ec270..767efa6 100644 --- a/web/package.json +++ b/web/package.json @@ -4,17 +4,19 @@ "private": true, "scripts": { "serve": "npx servor dist", - "vue-serve": "vue-cli-service serve", "build": "vue-cli-service build", - "lint": "vue-cli-service lint" + "lint": "vue-cli-service lint", + "vue-serve": "vue-cli-service serve" }, "dependencies": { - "vue": "^3.0.0" + "vue": "^3.0.0", + "vue-router": "^4.0.0-0" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/parser": "^4.18.0", "@vue/cli-plugin-eslint": "~4.5.0", + "@vue/cli-plugin-router": "^4.5.14", "@vue/cli-plugin-typescript": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/compiler-sfc": "^3.0.0", diff --git a/web/src/App.vue b/web/src/App.vue index fe62e4d..113b6b8 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -1,20 +1,11 @@ - - diff --git a/web/src/components/HelloWorld.vue b/web/src/components/HelloWorld.vue index 3113349..8a1e447 100644 --- a/web/src/components/HelloWorld.vue +++ b/web/src/components/HelloWorld.vue @@ -87,10 +87,10 @@