3

我正在使用jQuery 终端来构建我的网站。

现在我正在构建signin命令:

signin: function() {
  this.read("user id: ").then(userId =>
  this.set_mask('*').read("password: ").then(password =>
    // signin process
  ));
}

此代码工作正常。但之后这个过程set_mask('*')会一直存在。

我试过this.set_mask(false);了,但它不起作用。如何取消设置此面具?

任何帮助表示赞赏

4

2 回答 2

1

我的解决方案,这里是变量声明和一些代码的示例。

var term = $(".terminal").terminal({
  signin: function() {
    this.read("user id: ").then(userId =>
    this.set_mask('*').read("password: ").then(password =>
      // signin process
    term.set_mask(false);    // it works!
    // this.set_mask(false); // it doesn't work
    ));
  }
});

谢谢,希望这段代码对任何人都有帮助

于 2021-03-31T03:59:33.897 回答
0

也许这有帮助。

set_mask is defined as a boolean
set_mask(false or true)

我不熟悉 Jquery 终端。也许你可以使用例如 if (mask....) {

mask

只需探索示例https://terminal.jcubic.pl/examples.php

于 2021-03-30T08:47:51.990 回答