当您像这样创建空的Svelte组件(例如ComponentName.svelte)时:
<script>
export let segment;
</script>
<style>
</style>
<svelte:head>
<title>Lorem ipsum</title>
</svelte:head>
<p>lorem ipsum...</p>
Run Code Online (Sandbox Code Playgroud)
你会有错误:
<ComponentName> was created without expected prop 'segment'
Run Code Online (Sandbox Code Playgroud) 我想在没有CLI的情况下创建Angular应用程序.之后我收到一个错误:
错误:无法解析ApplicationModule的所有参数:(?).
项目包含几个文件,主要是:
•main.ts
import 'zone.js/dist/zone'
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './modules/app.module';
platformBrowserDynamic().bootstrapModule(AppModule)
Run Code Online (Sandbox Code Playgroud)
•component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `Hello World`
})
export class AppComponent {}
Run Code Online (Sandbox Code Playgroud)
•module.ts
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { AppComponent } from "../components/app.component";
@NgModule({
imports: [
BrowserModule,
],
declarations: [
AppComponent
],
bootstrap: [
AppComponent
]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
我之前在StackOverflow上搜索,但我找不到解决方案.当有人想要在没有@Injectable装饰器的情况下注入服务时,会发生类似的错误.在我的情况下,我没有任何服务,所以恐怕没有人有同样的错误.
Angular CLI很容易启动项目,但只有当您想要没有生成器的安装项目时,您才知道在引导程序应用程序期间需要创建哪些部分.
我发现的所有示例都是调用 API 并定义方法和 URL。例如
cy.server()
cy.route({
method: 'GET',
url: 'https://www.something.com',
}).as('get_jobs')
cy.get('[data-cy="job-search-input"] button').click()
cy.wait('@get_jobs').then((xhr) => {
cy.log(xhr.response.body.data)
})
Run Code Online (Sandbox Code Playgroud)
我想要的只是选择按钮,按单击并阅读它给我的响应。我不想再次定义 url 和方法,而是使用代码中已经使用的那个,并在按下按钮后检查它给我的响应。
我怎样才能做到这一点?