小编Ahm*_*him的帖子

eslint 未检测到 TS 错误

我有一个使用 typescript 的 nextJS 应用程序。我使用 VSCode 进行开发。我注意到,当我打开一个有错误的文件时,VSCode 按预期显示 TS 错误,但eslint事实并非如此。

\n

例如,这是我的 VSCode 错误:

\n

VSCode TS 错误

\n

但这是我的 linting 结果:

\n
\xe2\x96\xb6 yarn lint\n\nyarn run v1.22.10\n$ eslint .\n(node:83388) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time\n(node:83388) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time\n\xe2\x9c\xa8  Done in 5.26s.\n
Run Code Online (Sandbox Code Playgroud)\n

以下是一些可能有助于识别问题的文件:

\n

.eslintrc.js:

\n
module.exports = {\n  plugins: [\n    \'@typescript-eslint\',\n  ],\n  extends: [\n    \'airbnb-typescript\',\n    \'airbnb/hooks\',\n    \'plugin:@typescript-eslint/recommended\',\n    \'plugin:@typescript-eslint/recommended-requiring-type-checking\',\n …
Run Code Online (Sandbox Code Playgroud)

typescript eslint visual-studio-code next.js typescript-eslint

6
推荐指数
1
解决办法
5215
查看次数

Vue.js - 重新计算组件中的计算属性

我对这个问题进行了很多搜索,但没有找到直接的答案。我有一个计算属性,它也取决于窗口高度,因此每次调整窗口大小时我都需要重新计算它。尝试过使用$forceUpdate(),但我认为它不适用于组件。这是我的组件:

Vue.component('trades-component', {

  mixins: [tradingMixin],

  created: function() {
    var that = this;
    // recompute visible trades if window resized
    $( window ).on( "resize", function() {
      that.$forceUpdate();
    });
    $( window ).resize();
  },

  computed: {

    visibleTradesCount: function() {
      var colOffset = $(".left-col").offset();
      var colHeight = $(".left-col").height();
      var tableOffset = $(".left-col #trade-history table").offset();
      var tableHeight = colHeight - (tableOffset.top - colOffset.top) - this.rowHeight;
      return Math.floor(tableHeight / this.rowHeight)
    }
  }
})
Run Code Online (Sandbox Code Playgroud)

我知道可能的解决方法,但想知道是否有一种方法可以强制重新计算组件中的特定属性或所有计算属性。

javascript vue.js vue-component vuejs2

5
推荐指数
1
解决办法
1万
查看次数