[improvement] SwipeCell: jsx (#2632)

This commit is contained in:
neverland
2019-01-27 08:50:20 +08:00
committed by GitHub
parent 874d2f79ca
commit ccdfc7124a
3 changed files with 76 additions and 103 deletions
+17
View File
@@ -0,0 +1,17 @@
import { on, off } from '../utils/event';
export default config => ({
mounted() {
config.handler = event => {
if (!this.$el.contains(event.target)) {
this[config.method]();
}
};
on(document, config.event, config.handler);
},
beforeDestroy() {
off(document, config.event, config.handler);
}
});