我想在反应组件加载后立即将焦点设置在按钮上,以便用户可以仅使用键盘按下按钮。
这就是我试图做的,但这似乎不起作用。
class CustomTextInput extends React.Component {
constructor(props) {
super(props);
// create a ref to store the textInput DOM element
this.logButton = React.createRef();
}
componentDidUpdate(){
this.logButton.current.focus();
}
render() {
// tell React that we want to associate the <input> ref
// with the `textInput` that we created in the constructor
return (
<div>
<Button ref={this.logButton} outline color="primary" size="sm" onClick={this.logManualRequestModal}>
Log request
</Button>
</div>
);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用tabler-react组件
我在 Dialogflow 履行中使用 firebase admin 版本 6.0.0 发送 fcm 通知。
admin.messaging().send({
"message": {
"notification": {
"title": "Portugal vs. Denmark",
"body": "great match!"
},
"token": user_info.device_id
}
})
.then((response) => {
// Response is a message ID string.
console.log('Successfully sent message:', response);
})
.catch((error) => {
console.log('Error sending message:', error);
});
Run Code Online (Sandbox Code Playgroud)
这是我收到的错误
Error: Exactly one of topic, token or condition is required
at FirebaseMessagingError.Error (native)
at FirebaseMessagingError.FirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:39:28)
at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:85:28)
at new FirebaseMessagingError (/user_code/node_modules/firebase-admin/lib/utils/error.js:241:16)
at validateMessage …Run Code Online (Sandbox Code Playgroud)