@beisen/upaas-lookup-v2
v0.0.17
Published
## 参数
Downloads
36
Maintainers
Readme
UpaasLookUpV2
参数
options:{
onChange:(val) => {console.log('onChange')}, //抛出的onchange方法
value: this.state.inputValue, //input中的默认值
popComponent:<div>321321</div>, //全部查找弹窗中的组件,indexpage
status: 'search', //edit or search
title: 'LookUpV2', //title
required: true, //必填
readOnly: false, //只读
disabled: false, //禁用
helpMsg: 'sds', //帮助提示
isShowFindAll: true, //是否显示全部查找
isNotAllow: false, //是否有权限
// errorMsg: 'dfsfdsfsdf', //错误信息
// promptMsg: 'sfsfsf',
// multiple: false,
listValue: [], //下拉数据
isFetching: false, //是否在获取数据
// multiValue: [],
listClick:(event, data) => {console.log('listClick')}, 点击下拉中数据的回调
// multipleClear: this.multipleClear,
onFindAll: () => {console.log('onFindAll execute')}, //点击全部查找
onSubmitPop: () => { console.log("onSubmitPop")}, //弹窗点击确定
onClosePop: () => { console.log("onClosePop")}, //弹窗关闭方法
clearPageData: () => {console.log("clearPageData")}, // 原action方法,清空page数据
getPageData: () => {console.log("getPageData")} //原action方法,获取page数据
}
###demo
class App extends Component {
constructor(props) {
super(props);
this.multiple = false;
this.multiValue = [];
this.listValue = null;
this.state = {
inputValue: ''
};
}
inputOnChange = (val) => {
console.info(val);
let _value;
if (typeof val == 'string') {
_value = val;
} else {
_value = val.target.value;
}
this.isFetching = true;
if (_value == '海淀') {
this.listValue = [
[{isShowCustomViewButton:true, avatars: {100022: {hasAvatar: true, small: "//cache.tita.gift/Image/100013/4233e527dcd24ea594614b707f21cb1d_s.jpg",color: '#8dc8ea'}}, name:"Address", text:"11海淀", value:"海淀"}],
[{isShowCustomViewButton:true, avatars: {100022: {hasAvatar: true, small: "//cache.tita.gift/Image/100013/4233e527dcd24ea594614b707f21cb1d_s.jpg",color: '#8dc8ea'}}, name:"Address", text:"11海淀", value:"海淀"}],
[{isShowCustomViewButton:true, avatars: {100022: {hasAvatar: true, small: "//cache.tita.gift/Image/100013/4233e527dcd24ea594614b707f21cb1d_s.jpg",color: '#8dc8ea'}}, name:"Address", text:"11海淀", value:"海淀"}],
[{isShowCustomViewButton:true, avatars: {100022: {hasAvatar: true, small: "//cache.tita.gift/Image/100013/4233e527dcd24ea594614b707f21cb1d_s.jpg",color: '#8dc8ea'}}, name:"Address", text:"11海淀", value:"海淀"}],
[{isShowCustomViewButton:true, avatars: {100022: {hasAvatar: true, small: "//cache.tita.gift/Image/100013/4233e527dcd24ea594614b707f21cb1d_s.jpg",color: '#8dc8ea'}}, name:"Address", text:"11海淀", value:"海淀"}]
];
this.isFetching = false;
// this.isNotAllow = true;
} else if (_value == '222') {
this.listValue = [
{
name: '1',
text: '2'
},
{
name: '1',
text: '2'
}
];
this.isFetching = false;
} else {
this.listValue = [];
this.isFetching = false;
}
// this.listValue = null;
this.setState({inputValue: _value});
}
listClick = (event, data) => {
console.log(event, data, '------')
}
multipleClear = (index) => {
this.multiValue.splice(index, 1);
}
render () {
this.data = {
onChange: this.inputOnChange,
value: this.state.inputValue,
popComponent:<div>321321</div>,
status: 'search',
title: 'LookUpV2',
required: true,
readOnly: false,
disabled: false,
helpMsg: 'sds',
isShowFindAll: true,
isNotAllow: this.isNotAllow,
errorMsg: 'dfsfdsfsdf',
promptMsg: 'sfsfsf',
multiple: this.multiple,
listValue: this.listValue,
isFetching: false,
multiValue: this.multiValue,
listClick: this.listClick,
multipleClear: this.multipleClear,
onFindAll: () => {console.log('onFindAll execute')},
onSubmitPop: () => { console.log("onSubmitPop")},
onClosePop: () => { console.log("onClosePop")},
clearPageData: () => {console.log("clearPageData")},
getPageData: () => {console.log("getPageData")}
}
return (
<div>
<UpaasLookUpV2 {...this.data}/>
</div>
)
}
}
render(<App />, document.getElementById('content'))