in src/setter/expression-setter/index.tsx [93:123]
onChange(value: string) {
const realInputValue = value;
const realDataSource = null;
let nextCursorIndex: number;
// 更新值
// if (actionType === 'itemClick' || actionType === 'enter') {
// // const curValue = this.state.value;
// // if (curValue) {
// // realInputValue = curValue + realInputValue;
// // }
// }
// 更新数据源
const newState = {
value: realInputValue,
};
if (realDataSource !== null) newState.dataSource = realDataSource;
this.setState(newState, () => {
nextCursorIndex && this.setInputCursorPosition(nextCursorIndex);
});
// 默认加上变量表达式
this.t && clearTimeout(this.t);
this.t = setTimeout(() => {
const { onChange } = this.props;
// realInputValue = realInputValue ? `{{${realInputValue}}}` : undefined;
onChange &&
onChange({
type: 'JSExpression',
value: realInputValue,
});
}, 300);
}