我正在使用 axios 向diro发送请求以创建具有端点的用户/user/create
。
但是,我不断收到这样的错误:
Error response: { Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:448:20)
at TLSSocket._finishInit (_tls_wrap.js:633:8)
Run Code Online (Sandbox Code Playgroud)
这是我的要求:
const DIRO_API_KEY = ******
createUserToDiro = ({
phone,
first_name,
last_name,
birth_date,
mcc_code
}) => {
const mobile = phone;
const firstname = first_name;
const lastname = last_name;
const dob = formatDiroDob(birth_date);
const mcc = mcc_code;
axios.post('https://api.dirolabs.com/user/create'), {
firstname,
lastname,
dob,
mobile,
mcc,
apikey: DIRO_API_KEY
})
.then(rs => console.log('Success response:', rs))
.catch(err => console.log('Error …
Run Code Online (Sandbox Code Playgroud) 目前,我看到这样的行为:
render() {
const list = [];
return (
<div>
{ list.length && <div>List rendered</div> }
</div>
)
}
Run Code Online (Sandbox Code Playgroud)
我的预期是在该条件下没有呈现任何内容,但是呈现了字符串“0”(字符串“0”是list.length
)。我不知道为什么。有人可以帮我向 React 解释这个案例吗?
我有两个这样的说法。他们为什么都评价为false
?
console.log([] == true)
console.log(![] == true)
Run Code Online (Sandbox Code Playgroud)
如果[] == true
不是false
应该![] == true
导致的true
?
我在我的 svelte 项目中使用 Typescript,我需要为我的事件定义强类型。但我找不到任何方法可以做到这一点。
<script lang="ts">
const onKeyUp = (event: [type here]) => {
console.log({ event })
// const {target, keyCode} = event
}
</script>
<input type="text" on:keyup={onKeyUp} />
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮助我!
我有一个像这样的输入组件:
<script lang="ts"></script>
<div class="wrap-input">
<input
class='input'
type="text"
{...$$restProps}
/>
</div>
<style lang="scss">
// some styles
</style>
Run Code Online (Sandbox Code Playgroud)
我在父级上使用了输入组件:
<script lang="ts">
// function event handler
const onKeyUp = (event) => {
console.log(event)
}
</script>
<main>
<Input
on:keyup={onKeyUp} // How I can send this event to input component as $$restProps
className="input-todo"
placeholder="What needs to be done ?"
/>
</main>
<style lang="scss">
// some styles
</style>
Run Code Online (Sandbox Code Playgroud)