增加cell swipe组件 (#39)
* add cell swipe * cell swipe * bugfix * test * style
This commit is contained in:
@@ -5,6 +5,7 @@ import Radio from '../packages/radio/index.js';
|
||||
import Cell from '../packages/cell/index.js';
|
||||
import Icon from '../packages/icon/index.js';
|
||||
import CellGroup from '../packages/cell-group/index.js';
|
||||
import CellSwipe from '../packages/cell-swipe/index.js';
|
||||
import Popup from '../packages/popup/index.js';
|
||||
import Dialog from '../packages/dialog/index.js';
|
||||
import Picker from '../packages/picker/index.js';
|
||||
@@ -47,6 +48,7 @@ const install = function(Vue) {
|
||||
Vue.component(Cell.name, Cell);
|
||||
Vue.component(Icon.name, Icon);
|
||||
Vue.component(CellGroup.name, CellGroup);
|
||||
Vue.component(CellSwipe.name, CellSwipe);
|
||||
Vue.component(Popup.name, Popup);
|
||||
Vue.component(Picker.name, Picker);
|
||||
Vue.component(RadioGroup.name, RadioGroup);
|
||||
@@ -89,6 +91,7 @@ module.exports = {
|
||||
Cell,
|
||||
Icon,
|
||||
CellGroup,
|
||||
CellSwipe,
|
||||
Popup,
|
||||
Dialog,
|
||||
Picker,
|
||||
|
||||
@@ -55,3 +55,44 @@ export function removeClass(el, cls) {
|
||||
el.className = trim(curClass);
|
||||
}
|
||||
};
|
||||
export const once = function(el, event, fn) {
|
||||
var listener = function() {
|
||||
if (fn) {
|
||||
fn.apply(this, arguments);
|
||||
}
|
||||
off(el, event, listener);
|
||||
};
|
||||
on(el, event, listener);
|
||||
};
|
||||
|
||||
export const on = (function() {
|
||||
if (document.addEventListener) {
|
||||
return function(element, event, handler) {
|
||||
if (element && event && handler) {
|
||||
element.addEventListener(event, handler, false);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return function(element, event, handler) {
|
||||
if (element && event && handler) {
|
||||
element.attachEvent('on' + event, handler);
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
export const off = (function() {
|
||||
if (document.removeEventListener) {
|
||||
return function(element, event, handler) {
|
||||
if (element && event) {
|
||||
element.removeEventListener(event, handler, false);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return function(element, event, handler) {
|
||||
if (element && event) {
|
||||
element.detachEvent('on' + event, handler);
|
||||
}
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user