Browse Source

feat(vConsole): 开发环境与测试环境添加vConsole

曾志翔 2 years ago
parent
commit
24f16641e6
4 changed files with 56 additions and 0 deletions
  1. 1 0
      nuxt.config.js
  2. 46 0
      package-lock.json
  3. 1 0
      package.json
  4. 8 0
      plugins/vconsole.js

+ 1 - 0
nuxt.config.js

@@ -80,6 +80,7 @@ export default {
     '~/plugins/filters',
     '~/plugins/vue-data-dict',
     { src: '~/plugins/v-mask', mode: 'client' },
+    { src: '~/plugins/vconsole', mode: 'client' },
     // '~/plugins/jweixin',
     // '~/plugins/umeng-datasources',
     // '@/plugins/vant',

+ 46 - 0
package-lock.json

@@ -24,6 +24,7 @@
         "nuxt": "^2.15.8",
         "v-mask": "^2.3.0",
         "vant": "^2.12.47",
+        "vconsole": "^3.14.6",
         "vee-validate": "^3.4.14",
         "vue": "^2.6.14",
         "vue-data-dict": "^1.0.6",
@@ -6404,6 +6405,14 @@
         "node": ">=0.10.0"
       }
     },
+    "node_modules/copy-text-to-clipboard": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.0.1.tgz",
+      "integrity": "sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q==",
+      "engines": {
+        "node": ">=12"
+      }
+    },
     "node_modules/core-js": {
       "version": "3.22.7",
       "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.22.7.tgz",
@@ -12390,6 +12399,11 @@
         "npm": ">=1.4.0"
       }
     },
+    "node_modules/mutation-observer": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
+      "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
+    },
     "node_modules/mute-stream": {
       "version": "0.0.8",
       "resolved": "https://registry.npmmirror.com/mute-stream/-/mute-stream-0.0.8.tgz",
@@ -18525,6 +18539,17 @@
         "node": ">= 0.8"
       }
     },
+    "node_modules/vconsole": {
+      "version": "3.14.6",
+      "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.14.6.tgz",
+      "integrity": "sha512-8Ffk2SfNe6EzKqZ0aNnNjpAVBVT7zgJo81lYEJdKySYLVYBeSawdSkWi9fSjDg3WsQhgS1vNPmRqJDTuwdVbnQ==",
+      "dependencies": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
+    },
     "node_modules/vee-validate": {
       "version": "3.4.14",
       "resolved": "https://registry.npmmirror.com/vee-validate/-/vee-validate-3.4.14.tgz",
@@ -25576,6 +25601,11 @@
       "resolved": "https://registry.npmmirror.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
       "integrity": "sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw=="
     },
+    "copy-text-to-clipboard": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.0.1.tgz",
+      "integrity": "sha512-rvVsHrpFcL4F2P8ihsoLdFHmd404+CMg71S756oRSeQgqk51U3kicGdnvfkrxva0xXH92SjGS62B0XIJsbh+9Q=="
+    },
     "core-js": {
       "version": "3.22.7",
       "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.22.7.tgz",
@@ -30278,6 +30308,11 @@
       "resolved": "https://registry.npmmirror.com/mustache/-/mustache-2.3.2.tgz",
       "integrity": "sha512-KpMNwdQsYz3O/SBS1qJ/o3sqUJ5wSb8gb0pul8CO0S56b9Y2ALm8zCfsjPXsqGFfoNBkDwZuZIAjhsZI03gYVQ=="
     },
+    "mutation-observer": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
+      "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
+    },
     "mute-stream": {
       "version": "0.0.8",
       "resolved": "https://registry.npmmirror.com/mute-stream/-/mute-stream-0.0.8.tgz",
@@ -35263,6 +35298,17 @@
       "resolved": "https://registry.npmmirror.com/vary/-/vary-1.1.2.tgz",
       "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="
     },
+    "vconsole": {
+      "version": "3.14.6",
+      "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.14.6.tgz",
+      "integrity": "sha512-8Ffk2SfNe6EzKqZ0aNnNjpAVBVT7zgJo81lYEJdKySYLVYBeSawdSkWi9fSjDg3WsQhgS1vNPmRqJDTuwdVbnQ==",
+      "requires": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
+    },
     "vee-validate": {
       "version": "3.4.14",
       "resolved": "https://registry.npmmirror.com/vee-validate/-/vee-validate-3.4.14.tgz",

+ 1 - 0
package.json

@@ -37,6 +37,7 @@
     "nuxt": "^2.15.8",
     "v-mask": "^2.3.0",
     "vant": "^2.12.47",
+    "vconsole": "^3.14.6",
     "vee-validate": "^3.4.14",
     "vue": "^2.6.14",
     "vue-data-dict": "^1.0.6",

+ 8 - 0
plugins/vconsole.js

@@ -0,0 +1,8 @@
+import VConsole from 'vconsole';
+
+export default function (c, i) {
+  if (['development', 'test'].includes(process.env.MODE)) {
+    const vConsole = new VConsole();
+    i('vConsole', vConsole);
+  }
+}