ssc-refer2

0.1.37 • Public • Published

SSC-Refer2 Travis AppVeyor npm Codecov

SSC 3.0 Refer2组件

使用

npm install ssc-refer2 --save
import { Refers } from 'ssc-refer2';
...
 
handleChange(selected) {
 console.log('oncliclk'+JSON.stringify(selected));
}
 
handleBlur(e) {
  // alert(888);
  // console.log('blurblurblur'+e);
  // console.log(JSON.stringify(this._myrefers.getInstance().getInputTextValue())); //获取输入框里当前输入的值
  // console.log(JSON.stringify(this._myrefers.getInstance().clear()); //清除
  // console.log(JSON.stringify(this._myrefers.getInstance().getData())); //获取当前选中项
  // console.log(JSON.stringify(this._myrefers.getInstance().hideRefers)); //显示参照
  // this._listrefers.getInstance().hideRefers();
 
}
 
renderMenuItemChildren(option, props, index) {
  return [
    <strong key="name">{option.name}</strong>,
    <div key="code">
      Code: {option.code}
    </div>,
  ];
}
 
render() {
  const defaultData =   [];
  const referConditions = {"refCode":"dept","refType":"table","displayFields":["code","name","email"]};
  const referDataUrl = "http://127.0.0.1:3009/refbase_ctr/queryRefJSON";
 
  return (
    <Refers
      emptyLabel=""
      labelKey="name"
      onChange={this.handleChange}
      onBlur={this.handleBlur}
      placeholder="请选择..."
      referConditions={referConditions}
      referDataUrl={referDataUrl}
      referType="list"
      defaultSelected={defaultData}
      ref={(ref) => { this.listrefers = ref; }}
      multiple
      debugMode
      renderMenuItemChildren={this.renderMenuItemChildren}
    />
  );
}

文档

API文档中带有示例代码,并且可以在线编辑并运行代码。

Dependents (1)

Package Sidebar

Install

npm i ssc-refer2

Weekly Downloads

2

Version

0.1.37

License

MIT

Last publish

Collaborators

  • xxd3vin