我想使用AntDesign 库中的图像上传器。这是一个快照
import { Upload, Icon, Modal } from 'antd'
class PicturesWall extends React.Component {
state = {
previewVisible: false,
previewImage: '',
fileList: [],
}
handleCancel = () => this.setState({ previewVisible: false })
handlePreview = file => {
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
})
}
handleChange = ({ fileList }) => this.setState({ fileList })
render() {
const { previewVisible, previewImage, fileList } = this.state
const uploadButton = (
<div>
<Icon type="plus" />
<div className="ant-upload-text">Upload</div>
</div> …Run Code Online (Sandbox Code Playgroud) 嗨,我正在使用 React Material UI 选项卡,我注意到刷新时网站没有选择选项卡。我怎样才能防止这种情况发生?这是一个代码类型的材料 ui 选项卡
class SimpleTabs extends React.Component {
state = {
value: 0,
}
handleChange = (event, value) => {
this.setState({ value })
}
render() {
const { classes } = this.props
const { value } = this.state
return (
<div className={classes.root}>
<AppBar position="static">
<Tabs value={value} onChange={this.handleChange}>
<Tab label="Item One" />
<Tab label="Item Two" />
<Tab label="Item Three" />
</Tabs>
</AppBar>
{value === 0 && <TabContainer>Item One</TabContainer>}
{value === 1 && <TabContainer>Item Two</TabContainer>}
{value === 2 …Run Code Online (Sandbox Code Playgroud) 我在 Windows 上的 Git bash 中遇到了python 冻结的已知问题。stackoverflow 上的许多答案都建议使用WinPTY。
当我使用时,它工作正常:
winpty python foo.py
但是我将 python 程序作为 npm 脚本的一部分运行。我的 package.json 有这个:
"scripts": {
"start": "python foo.py && something else"
}
Run Code Online (Sandbox Code Playgroud)
所以我想我也需要用 WinPTY 运行 npm 脚本:
winpty npm start
但这是行不通的。我在不同的环境中收到了不同的错误消息。
winpty:错误:无法启动“npm”:在路径中找不到
错误 0x2 启动 npm start
任何想法为什么 npm 和 winpty 不能一起工作?
如果我在npm start没有 winpty 的情况下运行它可以正常工作。winpty node也有效。
我正在尝试将值列表传递给按钮。单击按钮时,应该会出现具有特定映射值的模态,但在我的情况下,只有数组中的最后一个值(3)出现在所有模态中...我应该如何修复它?
state = {
open: false,
stationData : [
{ id:1, number:'1' },
{ id:2, number:'2' },
{ id:3, number:'3' }
],
};
handleOpen = () => {
this.setState({ open: true });
};
handleClose = () => {
this.setState({ open: false });
};
render() {
const {stationData} = this.state;
{stationData.map((station,index) => (
<div key={index}>
<Button variant="contained" color="primary" style={styles.button} onClick={this.handleOpen}>
{station.number}
</Button>
<Modal
open={this.state.open}
onClose={this.handleClose}
aria-labelledby={index}
aria-describedby={index}
>
<div style={styles.modal}>
{station.number}
</div>
</Modal>
</div>
))}
}
Run Code Online (Sandbox Code Playgroud)
查看此代码沙箱
遵循此文档:https : //docs.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/rich-media-shares上传图像以在 LinkedIn 中的组织共享中引用。
使用Assets API成功上传图片。URN 采用这种格式 -urn:li:digitalmediaAsset:XXX
使用资产 ID 从 digitalmediaAsset URN检索资产信息显示以下状态:
{
"serviceRelationships": [
{
"identifier": "urn:li:userGeneratedContent",
"relationshipType": "OWNER"
}
],
"recipes": [
{
"recipe": "urn:li:digitalmediaRecipe:feedshare-image",
"status": "AVAILABLE"
}
],
"mediaTypeFamily": "STILLIMAGE",
"created": 1579015000150,
"lastModified": 1579015039823,
"id": "XXX",
"status": "ALLOWED"
}
Run Code Online (Sandbox Code Playgroud)
但是当我使用 Assets URN编写共享时-
POST https://api.linkedin.com/v2/shares
{
"content": {
"contentEntities": [
{
"entity": "urn:li:digitalmediaAsset:XXX"
}
],
"description": "content description",
"title": "Test Share with Content"
},
"distribution": {
"linkedInDistributionTarget": …Run Code Online (Sandbox Code Playgroud) 这是我第一次使用Redux和Redux Persist。当我尝试运行我的应用程序时出现此错误(在index.js第20行中):
TypeError:未定义不是对象(正在评估“ store.getState”)
index.js:
import React from 'react';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import { Provider } from 'react-redux';
import {persistor, store}from './store/configureStore';
import { PersistGate } from 'redux-persist/integration/react';
const RNRedux = () => (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App/>
</PersistGate>
</Provider>
)
AppRegistry.registerComponent(appName, () => RNRedux);
Run Code Online (Sandbox Code Playgroud)
App.js:
import {createStackNavigator, createAppContainer} from 'react-navigation';
import Register from './components/Register';
import Home from './components/Home';
import Login from './components/Login'; …Run Code Online (Sandbox Code Playgroud) reactjs ×3
material-ui ×2
antd ×1
git-bash ×1
linkedin ×1
linkedin-api ×1
npm ×1
react-native ×1
redux ×1
tabs ×1
windows ×1