小编MrL*_*oon的帖子

ESLint 要求分号并同时将其删除

我正在配置 ESLint(因为 TSLint 即将被弃用)来处理我的 .ts 文件。我有这个很小的文件:

export default interface Departure {
  line: string;
  direction: string;
  time: Date;
};
Run Code Online (Sandbox Code Playgroud)

在最后一次,分号所在的位置,我的 VSCode 中的 ESLint 发出两个错误信号:一个是关于缺少分号eslint(semi),另一个是关于不必要的分号eslint(no-extra-semi)

eslint 分号错误

以下是我的.eslintrc.js

module.exports = {
    "env": {
        "browser": true,
        "commonjs": true,
        "es6": true,
        "node": true
    },
    "extends": [
        "plugin:@typescript-eslint/recommended",
        "airbnb"
    ],
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaFeatures": {
            "jsx": true
        },
        "ecmaVersion": 2018
    },
    "plugins": [
        "react",
        "@typescript-eslint"
    ],
    "settings": {
        "import/resolver": {
            "node": {
                "extensions": …
Run Code Online (Sandbox Code Playgroud)

typescript eslint

16
推荐指数
3
解决办法
7344
查看次数

PyQt QtWebChannel:从 JavaScript 调用 Python 函数

我正在尝试使用 Qt classesQWebEngineViewQWebChannel在 HTML 页面和 Python 脚本之间建立简单的连接。目标只是在单击foo()标题时执行<h2>

import sys
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebChannel import QWebChannel
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage

html = '''
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>        
    <script src="qrc:///qtwebchannel/qwebchannel.js"></script>
    <script>
    var backend;
    new QWebChannel(qt.webChannelTransport, function (channel) {
        backend = channel.objects.backend;
    });

    document.getElementById("header").addEventListener("click", function(){
        backend.foo();
    });
    </script>
</head>
<body> <h2 id="header">Header.</h2> </body>
</html>
'''

class HelloWorldHtmlApp(QWebEngineView):

    def __init__(self):
        super().__init__()

        # setup a page with my …
Run Code Online (Sandbox Code Playgroud)

python pyqt pyqt5 qwebengineview qtwebchannel

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

WordPress安装后弹出Chrome而不是登录页面

所以我安装了wordpress(如果重要的话,在子文件夹中)。安装后我想登录我的管理页面(通过/wp-login.php)。

我看到的不是登录页面,而是 Chrome 登录弹出窗口。我安装 Wordpress 时使用的登录数据不起作用。

浏览器登录弹出

wordpress

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