在构建我的应用程序时,我收到以下错误,这对我来说似乎很奇怪,因为属性 appName 已声明:
../src/app/app.service.ts (30,14) 中的错误:类“AppService”错误地实现了接口“InternalStateType”。“AppService”类型中缺少属性“appName”。)
应用程序服务.ts
import {Injectable} from '@angular/core';
interface InternalStateType {
[key: string]: any;
appName: string;
darkMode: boolean;
defaultLang: string;
topnavTitle: string;
messagePanelOpen: boolean;
sidenavOpen: boolean;
sidenavMode: string;
sidenavCollapse: boolean;
pageFullscreen: boolean;
pageFooter: boolean;
initial: boolean
};
/**
* App service
*/
@Injectable()
export class AppService implements InternalStateType {
// Set your states default value.
private state: InternalStateType = {
appName: 'MyApp',
darkMode: false,
defaultLang: 'en',
topnavTitle: 'MyApp',
messagePanelOpen: false,
sidenavOpen: false,
sidenavMode: 'over',
sidenavCollapse: true,
pageFullscreen: …Run Code Online (Sandbox Code Playgroud) 我从 升级PHP 5.3到7.2并在 2 行代码中收到以下错误:
PHP 已弃用:函数 create_function() 已弃用
我搜索了论坛并尝试了各种形式的代码,但没有一个起作用。
代码1:
add_action( 'widgets_init', create_function( '', 'register_widget("layerslider_widget");' ) );
Run Code Online (Sandbox Code Playgroud)
代码2:
add_action( 'widgets_init', create_function( '', 'register_widget( "advanced_featured_page_widget" );' ) );
Run Code Online (Sandbox Code Playgroud)
感谢你的协助!
我的反应组件中有这张表。我需要应用onClick所有,<tr>但需要排除最后一列(<td>)。
可以这样做吗?
<tr
className="cursor-pointer"
key={activity._id}
onClick={() =>
activeTab === "active"
? this.setState({ activity, completeModal: true })
: this.setState({ activity, showModal: true })
}
>
<td>{moment(activity.date).format("MM/DD/YY h:mm a")}</td>
<td>{activity.manifestNumber}</td>
<td>
<NumberFormat
thousandSeparator={true}
displayType={"text"}
value={activity.grossWeight}
/>{" "}
lbs
</td>
<td>{activity.facility.name}</td>
</tr>
Run Code Online (Sandbox Code Playgroud) 我想使用react-hook-form制作简单的登录页面
我收到此错误:
模块“react-hook-form”没有导出成员“useForm”
import React from 'react';
import { Box, TextField } from '@mui/material';
import { SubmitHandler, useForm } from 'react-hook-form';
type InputForm = {
email: string,
password: string
}
const Login = () => {
const { register, handleSubmit } = useForm<InputForm>();
const onSubmit: SubmitHandler<InputForm> = (data: any) => console.log(data)
return (
<Box>
<form onSubmit={handleSubmit(onSubmit)}>
<TextField label="email" {...register("email")} />
<TextField label="email" {...register("password")} />
</form>
</Box>
)
}
export default Login
Run Code Online (Sandbox Code Playgroud)
这段代码给我以下错误
TS2305: Module '"react-hook-form"' has no exported member 'useForm'. …Run Code Online (Sandbox Code Playgroud) 如何获取服务代码?我尝试下面的代码,但它没有记录任何内容。
在 service.ts 文件中。
constructor(private http: HttpClient) { }
postForgotPass(email): Observable<Response> {
return this.http.post<Response>(envi.apiUrl +'/user/forgotpassword', {
"email": email,
"headers": headers,
observe: 'response'
})
}
Run Code Online (Sandbox Code Playgroud)
在我的 component.ts 文件中
sendForgotPass() {
return this.service.postForgotPass(this.emailFormControl.value)
.subscribe(
res => {
console.log(res.status);
})
}
Run Code Online (Sandbox Code Playgroud) 有两个切换按钮(编辑和提交),哪个按钮应该像点击时切换显示/隐藏样式一样工作
<button (click)="showEditBtn = false;" *ngIf="showEditBtn;"> Edit</button>
<button (click)="showEditBtn = true;" *ngIf="!showEditBtn;">Submit</button>
Run Code Online (Sandbox Code Playgroud)
我需要 showEditBtn变量应该是true默认值而不触及脚本文件
是否可以为模板中的变量赋值,如下例所示?
<div> {{ let showEditBtn = true }} </div>
Run Code Online (Sandbox Code Playgroud)
javascript variables angular angular-template-variable angular7
我有一个由这个 map 函数渲染的 React 组件:
<div className="links-container">
{links.map((link, i) => (
<Links
key={link.text}
icon={link.icon}
text={link.text}
isRight={i % 2 === 0 ? true : false}
/>
))}
</div>
Run Code Online (Sandbox Code Playgroud)
import React, { Component } from "react";
export default class Links extends Component {
render() {
const { icon, text, isRight } = this.props;
return (
<div style={{ alignSelf: isRight ? "flex-end" : "" }}>
<div className="link">
<img
className="link-img"
src={icon}
alt="link"
style={{ borderColor: isRight ? "#1689FC" : "#FD003A" }}
/>
<div className="link-text">{text}</div>
</div> …Run Code Online (Sandbox Code Playgroud) 期望的结果:“在 X% 和 Y% 之间”,以及输入组都在同一行。
这适用于常规表单字段,但不适用于输入组:
between
<div class="input-group d-inline-block" style="width: 5em;">
<input type="text" class="form-control" >
<div class="input-group-append">
<span class="input-group-text">%</span>
</div>
</div>
and
<div class="input-group d-inline-block" style="width: 5em;">
<input type="text" class="form-control" >
<div class="input-group-append">
<span class="input-group-text">%</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我点击按钮时听到声音。但我无法快速按下按钮来一遍又一遍地听到该声音,而是必须等到声音结束才能再次播放。如何让声音在播放时被新的咔嗒声打断,从头开始播放声音?
<script>
function play(){
var audio = document.getElementById("audio");
audio.play();
}
</script>
<button onclick="play()">
<audio id="audio" src="bell.ogg" ></audio> </button>
</body>
Run Code Online (Sandbox Code Playgroud) 我正在努力让timeout计时器在每次交互时重置document click。似乎clearTimeout不起作用。
jQuery:
$(document).click(function(e){
$("#vidBack").hide();
$(".mainer").show();
function stopTimer() {
clearTimeout(timer);
}
var timer = setTimeout(function(){
$(".bury").hide();
$(".mainer").hide();
$("#meetSub").hide();
$("#leaguesSub").hide();
$("#memberSub").hide();
$(".bury").hide();
$("#welcomeSub").show();
$("#vidBack").show();
$("#vida").prop("volume", 0);
}, 10000);
});
Run Code Online (Sandbox Code Playgroud) html ×5
javascript ×5
css ×3
reactjs ×3
angular ×2
typescript ×2
angular7 ×1
audio ×1
bootstrap-4 ×1
html-table ×1
jquery ×1
php ×1
php-7.2 ×1
settimeout ×1
variables ×1
wordpress ×1