描述:
Barcode 用于显示条形码,基于 Canvas 实现
$ npm install rax-barcode --save
import Barcode from "rax-barcode";
注: 1、支持列表中的 代表 h5 代表 weex 代表小程序 2、支持目前仅支持: CODE39,CODE128, CODE128A, CODE128B, CODE128C 3、参数参考https://github.com/lindell/JsBarcode
属性 | 类型 | 默认值 | 必填 | 描述 | 支持 |
---|---|---|---|---|---|
data | string |
- | true | 数据 | |
type | string |
CODE128 | false | 类型 | |
style | object |
{width:500,height:200} | false | 样式 | |
option | object |
- | false | 参数 |
import { createElement, render, Component } from "rax";
import DU from "driver-universal";
import View from "rax-view";
import BarCode from "rax-barcode";
class App extends Component {
constructor() {
super();
}
render() {
return (
<View style={{ flex: 1 }}>
<BarCode
data={"123456789"}
options={{
fillColor: "red"
}}
/>
</View>
);
}
}
render(<App />, document.body, { driver: DU });