我试图更新我的整个项目依赖项,并设法做到这一点,但是当我尝试运行测试时,ng test --no-watch它们不起作用,给我以下错误。
23 11 2022 12:33:58.268:INFO [Chrome Headless 107.0.5304.107 (Windows 10)]: Connected on socket JpJqOsJswlYxFGjeAAAB with id 12720855
Chrome Headless 107.0.5304.107 (Windows 10) ERROR
An error was thrown in afterAll
Uncaught TypeError: __webpack_require__(...).context is not a function
TypeError: __webpack_require__(...).context is not a function
at Object.4289 (http://localhost:9876/_karma_webpack_/webpack:/src/test.ts:18:25)
at __webpack_require__ (http://localhost:9876/_karma_webpack_/webpack:/webpack/bootstrap:19:1)
at __webpack_exec__ (http://localhost:9876/_karma_webpack_/main.js:10483:48)
at http://localhost:9876/_karma_webpack_/main.js:10484:54
at Function.__webpack_require__.O (http://localhost:9876/_karma_webpack_/webpack:/webpack/runtime/chunk loaded:23:1)
at http://localhost:9876/_karma_webpack_/main.js:10485:56
at webpackJsonpCallback (http://localhost:9876/_karma_webpack_/webpack:/webpack/runtime/jsonp chunk loading:71:1)
at http://localhost:9876/_karma_webpack_/main.js:1:87
Chrome Headless 107.0.5304.107 (Windows 10): Executed 0 of 0 ERROR …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Swagger UI 记录使用 Spring Boot 制作的 RESTFUL API,问题是当我打开 swagger-ui.html 查看我的文档时。
当我打开 swagger-ui.html 上的控制器查看我的方法时,它们是空白的,只有一个参数,即 Map 类型。显然,通过这个地图对象,我获取所需的参数并向数据库或其他内容发出请求。
我想知道如何告诉 swagger 这些方法需要一些特定的值或参数,而不仅仅是一个简单的 Map 对象,我想告诉用户使用 api 文档,他需要输入 key1,key2,key3调用这个方法。
有一个方法的示例
@GetMapping("/technical/sma/**")
public ArrayList<RegistroTecnico> recuperarSMA(@RequestParam Map<String, String> queryParameters) {
return this.recuperarIndicadorAVG("sma",queryParameters);
}
Run Code Online (Sandbox Code Playgroud)
如果没有办法,我想告诉 swagger 手动记录该方法所需的参数。
我对primeng 和angular 感到头疼,当我尝试将primeng 添加到Angular 的库时,这一切都会发生。
我做的步骤是下一个。
ng g library generales
Run Code Online (Sandbox Code Playgroud)
然后我尝试在使用生成的库上安装primeng
npm install primeng --save
npm install primeicons --save
Run Code Online (Sandbox Code Playgroud)
所以这些依赖项被添加到 package.json 作为库的依赖项,所以它很酷没问题。然后我想使用primeng表,所以我添加TableModule
到GeneralesModule的imports数组。如果我尝试编译它说它需要 angular/cdk 和材料依赖项,所以我使用以下命令安装它们
npm install --save @angular/material @angular/cdk @angular/animations
Run Code Online (Sandbox Code Playgroud)
我在使用primeng-table的库generales上制作我的组件,我也在exports数组上声明这个组件,因为我想在库外使用它。
然后我转到源并将 GeneralesModule 添加到导入数组,以便我可以使用其所有可导出组件,并在 src/app 中创建一个组件,该组件使用位于 generales 库中的组件的选择器。
好的,然后我开始它ng serve并按预期工作,但是如果我尝试使用ng build --prod它会给我以下错误:
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '@angular/cdk/bidi' in 'C:\Users\tihom\Desktop\projects\testing\primengTesting\src\app'
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '@angular/cdk/platform' in 'C:\Users\tihom\Desktop\projects\testing\primengTesting\src\app'
ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't …Run Code Online (Sandbox Code Playgroud) 我几乎失去了所有希望。我想做的基本上是实例化一个预制件,它基本上是一个带有图像的按钮,一旦实例化,我想设置一个要调用的 onClick 函数,但它一直告诉我这个错误:
GetComponent 要求请求的组件“Button”派生自 MonoBehaviour 或 Component 或者是一个接口
我不明白我做错了什么,这是我的代码:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
public class InventoryCoordinator : MonoBehaviour
{
// Start is called before the first frame update
public GameObject prefabPocion;
void Start()
{
GameObject panelInventuario = GameObject.FindGameObjectWithTag("Hotbar");
if (panelInventuario)
{
GameObject primerSlot = panelInventuario.transform.GetChild(0).gameObject;
GameObject segundoSlot = panelInventuario.transform.GetChild(1).gameObject;
GameObject tercerSlot = panelInventuario.transform.GetChild(2).gameObject;
var newPocion = Instantiate(this.prefabPocion, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
this.SetAndStretchToParentSize((UnityEngine.RectTransform)newPocion.transform.transform, (UnityEngine.RectTransform)primerSlot.transform.transform);
var button = GameObject.FindWithTag("PotionFreeze").gameObject.GetComponent<Button>();
button.clicked += manguito;
//newPocion.transform.parent = …Run Code Online (Sandbox Code Playgroud)