改变反应条形码格式
Changing react barcode format
我目前正在使用 react-barcode 包。它目前使用 format="CODE128"
格式,我需要将其更改为使用 Code 39 条码字体。如何将字体导入我的 React 项目并在 react-barcode 组件中使用它。如果不可能,我可以使用任何其他组件来实现此目的。
代码:
import React, { Component } from 'react';
import Barcode from 'react-barcode';
class Posts extends Component {
render () {
return (
<div>
<Barcode value="http://github.com/kciter" />
</div>
);
}
}
export default (Posts);
显示
code128 barcode
React-barcode 根本不使用条码字体。
您可以按照文档设置 format="CODE39"
。
<Barcode value="123456" format="CODE39" />
我目前正在使用 react-barcode 包。它目前使用 format="CODE128"
格式,我需要将其更改为使用 Code 39 条码字体。如何将字体导入我的 React 项目并在 react-barcode 组件中使用它。如果不可能,我可以使用任何其他组件来实现此目的。
代码:
import React, { Component } from 'react';
import Barcode from 'react-barcode';
class Posts extends Component {
render () {
return (
<div>
<Barcode value="http://github.com/kciter" />
</div>
);
}
}
export default (Posts);
显示 code128 barcode
React-barcode 根本不使用条码字体。
您可以按照文档设置 format="CODE39"
。
<Barcode value="123456" format="CODE39" />