import React from 'react';
import JsBarcode from 'jsbarcode';

export class RefundSheet extends React.Component {
constructor(props) {
super(props);
this.state = {
value: props.barCode, //由父组件传入用来生成条形码的字符串“barCode”
};
}
componentDidMount() {
  // 调用 JsBarcode方法生成条形码
JsBarcode(this.barcode, this.state.value, {
displayValue: false,
width: 1.5,
height: 50,
margin: 0,
});
}

render() {
return (
<div className="barcode-box">
<svg
ref={(ref) => {
this.barcode = ref;
}}
/>
</div>
);
}
}
export default RefundSheet;//导出组件

相关文章:

  • 2022-01-02
  • 2023-03-29
  • 1970-01-01
  • 2021-11-27
  • 2022-12-23
  • 2021-11-17
  • 2021-12-25
猜你喜欢
  • 2021-06-26
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案