如何让 console.log() 在 Vue-cli 应用程序中工作?

How can I make console.log() work in a Vue-cli app?

我正在尝试在我的 vue-cli 应用程序中添加一个 console.log() 调用以支持调试。这是我的模板的摘录

      <v-btn v-on:click.native="console.log('start button clicked')" 
      color="primary rounded-pill">
        Start
      </v-btn>

但是,当我 运行 localhost 上的应用程序时,我在控制台中收到以下消息:

vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "console" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

我查看了 ,但它似乎不适用于我的情况,因为我没有使用 eslint,而且我的 package.json 文件中没有 eslintConfig 部分。

知道还会发生什么吗?

  1. 尝试添加“this”,使其看起来像:this.console.log()
  2. 只需制作一个 vue 方法并在点击时调用它