【问题标题】:Cannot get vue-devtools standalone app to work, on vue-nativescript无法在 vue-nativescript 上使 vue-devtools 独立应用程序正常工作
【发布时间】:2020-04-18 14:52:40
【问题描述】:

我正在尝试使用 vue 学习 nativescript。 我已经了解了 devtools,以及应该有一个 Electron 独立应用程序的事实, npx vue-devtools,但它没有打开任何窗口。虽然 Electron 进程正在生成。

这是一个基本的应用程序 vue init nativescript-vue/vue-cli-template <name>,所以它应该“开箱即用”,有点。

该应用程序在模拟器和真实设备上都可以正常工作,所以我不知道出了什么问题。 我已经多次重新安装并重新启动项目,但没有任何更改。

这是 package.json

  "name": "test_devtools",
  "version": "1.0.0",
  "description": "A native application built with NativeScript-Vue",
  "author": "none",
  "license": "MIT",
  "nativescript": {
    "id": "org.nativescript.application",
    "templateVersion": "v2",
    "tns-android": {
      "version": "6.5.0"
    },
    "tns-ios": {
      "version": "6.5.0"
    }
  },
  "dependencies": {
    "@nativescript/theme": "^2.2.1",
    "nativescript-socketio": "^3.3.1",
    "nativescript-toasty": "^3.0.0-alpha.2",
    "nativescript-vue": "^2.6.0",
    "tns-core-modules": "^6.5.1"
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@vue/devtools": "^5.3.2",
    "babel-loader": "^8.1.0",
    "nativescript-dev-webpack": "^1.5.1",
    "nativescript-vue-devtools": "^1.2.0",
    "nativescript-vue-template-compiler": "^2.6.0",
    "nativescript-worker-loader": "~0.11.0",
    "node-sass": "^4.13.1",
    "vue-loader": "^15.9.1"
  }
}

还有 ma​​in.js

import Vue from "nativescript-vue";
import App from "./components/App";
Vue.use(VueDevtools);
// Prints Vue logs when --env.production is *NOT* set while building
Vue.config.silent = TNS_ENV === "production";
Vue.config.devtools = true;
new Vue({
  render: (h) => h("frame", [h(App)]),
}).$start();

【问题讨论】:

    标签: vue.js electron nativescript-vue vue-devtools


    【解决方案1】:

    在main.js中你需要先导入devtools,让它成为第一个导入:

    import VueDevtools from 'nativescript-vue-devtools'
    

    然后,在下面(不一定是下一条语句,您可以将它放在文件的较低位置):

    if (TNS_ENV !== 'production') {
      Vue.use(VueDevtools)
    }
    

    它是这样工作的。

    【讨论】:

    • 不走运,它对我不起作用我已经重新初始化文件,并使用您的代码构建,但它继续不为 Vue-Devtools 生成窗口
    猜你喜欢
    • 2019-08-19
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-29
    • 2021-07-14
    相关资源
    最近更新 更多