【问题标题】:React Avatar Editor not getting upload button反应头像编辑器没有上传按钮
【发布时间】:2019-03-30 18:41:10
【问题描述】:

我正在尝试使用 react-avatar-editor (https://www.npmjs.com/package/react-avatar-editor) 我已经安装并导入了组件但我没有得到按钮上传

这是我使用头像编辑器的简单组件

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Nav from "./Nav";
import AvatarEditor from 'react-avatar-editor'


export default class EditProfile extends Component {



    render () {
        return (
           <div>
               <Nav logoUrl="logo_white.svg"  color="#D41F36"/>

               hello there
               <AvatarEditor
                   image="/imgs/A066.jpg"
                   width={250}
                   height={250}
                   border={50}
                   color={[255, 255, 255, 0.6]} // RGBA
                   scale={1.5}
                   rotate={0}
               />
           </div>
        )
    }
}

I should have this screen but I had this

请帮忙解决这个问题?

【问题讨论】:

    标签: reactjs avatar


    【解决方案1】:

    react-avatar-editor 不处理图像选择。它专门处理给定图像的图像裁剪、调整大小和旋转。所以你需要编写一些代码来获取图像并传递给 react-avatar-editor 组件。

    您可以在这里查看操作方法https://github.com/mosch/react-avatar-editor/blob/master/docs/App.jsx

    【讨论】:

    • aah 我不知道...非常感谢,这是正确的回应,也感谢您的链接!
    猜你喜欢
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-04
    • 2023-03-21
    • 1970-01-01
    相关资源
    最近更新 更多