【问题标题】:What is proper way of starting a new nativescript-vue project with Typescript support?在 Typescript 支持下启动新的 nativescript-vue 项目的正确方法是什么?
【发布时间】:2020-06-18 22:01:35
【问题描述】:

我希望能够在 Vue 实例方法中使用 Typescript,如 nativescript-vue.org 的 blog page 中所述

当我使用 vue init nativescript-vue/vue-cli-template <project-name> 创建一个新的 nativescript-vue 项目时,调试屏幕中会出现以下警告。

tns debug android

总是给出以下错误行...

JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> CreateElement(NativePage)'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> CreateElement(NativeActionBar)'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> AppendChild(ElementNode(nativepage), ElementNode(nativeactionbar))'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> CreateElement(nativegridlayout)'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> CreateElement(nativelabel)'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> AppendChild(ElementNode(nativegridlayout), ElementNode(nativelabel))'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> AppendChild(ElementNode(nativepage), ElementNode(nativegridlayout))'
JS: '{NSVue (Vue: 2.6.10 | NSVue: 2.5.0)} -> AppendChild(ElementNode(nativeframe), ElementNode(nativepage))'

这些以 JS:... 行开头的样板警告是什么?


更新

在我添加 @vue/devtools nativescript-toasty nativescript-socketio nativescript-vue-devtools 后开始出现 JS 错误行

即使我删除了它们,控制台警告仍然存在。


我在想,quick start 页面是否已过时? 由于Vue-cli-template 在过去 30 天内没有收到任何更新。

注意:使用tns create 创建的项目不会出现此类错误。只有 vue-cli-template 有警告。

【问题讨论】:

  • 这些不是警告 - 这些是渲染器日志。您可以在 main/app.js 中使用 Vue.config.silent = true 关闭它们。
  • 请把你的答案写在答案表中好吗?

标签: typescript nativescript vue-cli nativescript-vue vue-devtools


【解决方案1】:

日志中提到的行不是错误也不是警告 - 它们是渲染器日志。

这些可以通过

关闭
Vue.config.silent = true

// Since NativeScript-Vue 2.5.0-alpha.3 the renderer logs
// can be disabled keeping other useful logs intact via
Vue.config.suppressRenderLogs = false

在app.js 或main.js 中(取决于使用的模板)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多