我有一个页面,用户可以在其中上传图像并使用一个 Api 进行编辑。
现在使用收到的 URL 格式的图像,需要在 Facebook、Twitter 和 Instagram 等社交媒体上共享。
以下是用于社交媒体重定向的 URL:
Facebook - https://www.facebook.com/sharer.php?u= ${window.location.href}?imageurl=${imageUrl} Twitter - https://twitter.com/intent/tweet?url= $ {window.location.href}?imageurl=${imageUrl} Instagram - 尚未找到
尝试过的事情:尝试使用 componentDidMount 中的 createElement 和 setAttribute 动态地将存储在状态中的 {imageUrl} 添加到元标记中,这没有在 facebook 中更新此图像,但能够在 head->meta 标记中的 og:image 中添加此图像。请为我提供一些解决方案。这将是一个很大的帮助。
<a
data-pgaction-redirection="0"
target="_blank"
rel="noopener noreferrer"
title={title}
href=`{https://www.facebook.com/sharer.php?u=${window.location.href}?
imageurl=${this.state.imageUrl}}`
>
Facebook
</a>
Run Code Online (Sandbox Code Playgroud) 我有一个要求,需要根据输入使用两个运算符(_and 和 _or)。
那么是否可以在 hasura graphql 中将运算符作为变量/参数传递?
我正在传递“match”变量,要求是我应该能够根据一些点击传递“_or”或“_and”,如果可能的话,请写下运算符的“类型”。
query Search($match: String) {
restaurants(where: {_or: [{cuisine: {_ilike: $match}}, {name: {_ilike: $match}}]}) {
cuisine
id
name
reviews {
body
}
}
}
#variable
{
"match":"%woodland%"
}
Run Code Online (Sandbox Code Playgroud)