UNPKG

evil-ui

Version:

[![npm package](https://img.shields.io/npm/v/mini-ali-ui.svg?style=flat-square)](https://www.npmjs.com/package/mini-ali-ui) [![GitHub stars](https://img.shields.io/github/stars/Alibaba-mp/mini-ali-ui.svg)](https://github.com/Alibaba-mp/mini-ali-ui/stargaz

48 lines (46 loc) 1.09 kB
import fmtEvent from "../_util/fmtEvent"; Component({ mixins: [], data: {}, props: { width: "", className: "", type: "text", value: "", checked: false, }, didMount(props) {}, didUpdate() { if (this.data.checked !== this.props.checked) { this.setData({ checked: this.props.checked, }); } }, didUnmount() {}, methods: { onChange(e) { this.setData({ checked: !this.data.checked, }); let event = fmtEvent(this.props, e); this.props.onChange && this.props.onChange(event); }, onKeyDown(e) { let event = fmtEvent(this.props, e); this.props.onKeyDown && this.props.onKeyDown(event); }, onFocus(e) { let event = fmtEvent(this.props, e); this.props.onFocus && this.props.onFocus(event); }, onBlur(e) { let event = fmtEvent(this.props, e); this.props.onBlur && this.props.onBlur(event); }, onPressEnter(e) { let event = fmtEvent(this.props, e); this.props.onPressEnter && this.props.onPressEnter(event); }, }, });