小编lol*_*zen的帖子

是否可以使用 RGB 或十六进制颜色在终端中对 Java 输出进行着色?

我正在尝试为我的java游戏输出彩色输出,该游戏仅使用终端,我想输出彩色的东西,但使用RGB值或十六进制颜色使用精确的颜色我该怎么办我已经看到了类似的颜色

“\u001B[0米”

但多样性不够,我该怎么办?

java colors output

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

如何使用 Angular 函数显示 HTML?

我想在角度组件中使用类型脚本函数显示格式化的 HTML,我希望它显示不同类型的问题,我尝试了这个,

\n\n
import {Component, OnInit} from \'@angular/core\';\nimport {TP, Question, Qtype} from "../tp";\nimport * as Exercice from \'../assets/Exercice.json\';\n\n@Component({\n  selector: \'app-tp\',\n  templateUrl: \'./tp.component.html\',\n  styleUrls: [\'./tp.component.css\']\n})\nexport class TpComponent implements OnInit {\n\n\n  constructor() {\n  }\n\n  ngOnInit(): void {\n  }\n\n  displayQCM(question: Question) {\n    return `\n      <div>\n            <hr class="w-100">\n            <h3>Question n\xc2\xb0${question.number} ${question.questionType}</h3>\n            <p>${question.questionContent}</p>\n            ...\n            QCM question element\n            ...\n        </div>\n    `;\n  }\n\n  displayTrueOrFalse(question: Question) {\n    return `\n      <div>\n            <hr class="w-100">\n            <h3>Question n\xc2\xb0${question.number} ${question.questionType}</h3>\n            <p>${question.questionContent}</p>\n            ...\n            true or false question element\n            ...\n        </div>\n    `;\n  }\n\n  displayQuestion(question: Question) …
Run Code Online (Sandbox Code Playgroud)

html typescript angular-cli angular

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

为什么我的 bootstrap 5 弹出窗口返回 Uncaught TypeError?

我想在我的 Angular 应用程序中使用 Bootstrap 5 弹出窗口。

这就是我所做的:

我的索引.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>my website</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root></app-root>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
  <script>
    var popover = new bootstrap.Popover(document.querySelector('.popoverable'), {
      container: 'body'
    })
  </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

应用程序组件.html

<button type="button" class="btn btn-secondary popoverable" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Bottom popover">
  Popover on bottom
</button>
Run Code Online (Sandbox Code Playgroud)

然后在我的页面上,我看到我的样式按钮,但弹出窗口没有出现,并且在控制台中我得到一个Uncaught TypeError: this._element is undefined.

有人能解决我的问题吗?

javascript twitter-bootstrap angular-cli bootstrap-5

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