import React, { Component } from 'react'; import { Button, Drawer } from "@alifd/next"; interface InputDrawerSetterProps { // 当前值 value: string; // 默认值 defaultValue: string; // setter 唯一输出 onChange: (val: string) => void; // AltStringSetter 特殊配置 placeholder: string; } export default class extends Component { constructor(props) { super(props); // 在构造函数中初始化状态 this.state = { visible: false, // 初始化为 false }; } componentDidMount() { const { onChange, value, defaultValue, } = this.props; if (value == undefined && defaultValue) { onChange(defaultValue); } } onOpen = () => { this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; render() { const { onChange, value } = this.props; return (
{/* onChange(val)} > */}
); } }