我正在尝试将 excel 文件上传到 S3 并通过 signedURL 下载它。我注意到该对象以不同的文件类型而不是预期的 xlsx 类型返回,因此在本地不可读。
我有两个 lambda,一个用于上传对象,另一个用于检索 signedURL。
上传:
async function () => {
const s3 = new aws.S3({ signatureVersion: 'v4' })
const params = {
Bucket: bucket,
Key: key
}
try {
const signedURL = await s3.getSignedUrl('getObject', params)
return response(200, signedURL)
} catch (err) {
console.log(JSON.stringify(err))
return response(400, err)
}
}
Run Code Online (Sandbox Code Playgroud)
获取签名网址:
async function () => {
const s3 = new aws.S3({ signatureVersion: 'v4' })
const params = {
Bucket: bucket,
Key: key
}
try …Run Code Online (Sandbox Code Playgroud) 在我的导航栏中,我有一个按钮,单击时将显示子菜单(项目列表)。每个项目都是它们自己的子组件,单击时我希望它们触发一个事件。onClick 事件侦听器根本没有响应。但是,其他鼠标事件确实适用(onMouseEnter、onMouseOut 等)。有人可能知道怎么回事吗?
子组件:NotificationItem.js
import React from "react"
import { connect } from "react-redux"
import { updateNotification } from "../../actions/notificationActions"
class NotificationItem extends React.Component{
constructor(props){
super(props)
this.handleOnClick = this.handleOnClick.bind(this)
}
handleOnClick = (event) => {
console.log("clicked")
// let notificationId = this.props.notification._id
// this.props.updateNotification(notificationId)
}
render(){
let {avatar, description, seen} = this.props.notification
return(
<div
onClick={this.handleOnClick}
className="d-flex notification-wrapper"
style={ seen ? (
{ width: "250px", whiteSpace: "normal", padding: "0.5rem" }
):( { width: "250px", whiteSpace: "normal", padding: "0.5rem", backgroundColor: "#d7e2f4" }
) …Run Code Online (Sandbox Code Playgroud)