From 6bfed913bd3899e7e91fa8e0dc704f98b8f8ead0 Mon Sep 17 00:00:00 2001 From: Junling Bu Date: Sat, 30 Jun 2018 10:28:46 +0800 Subject: [PATCH] =?UTF-8?q?feat[litemall-admin]:=20=E5=88=A0=E9=99=A4waves?= =?UTF-8?q?=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- litemall-admin/src/directive/sticky.js | 91 ------------------- litemall-admin/src/directive/waves/index.js | 13 --- litemall-admin/src/directive/waves/waves.css | 26 ------ litemall-admin/src/directive/waves/waves.js | 42 --------- litemall-admin/src/views/goods/attribute.vue | 8 +- litemall-admin/src/views/goods/comment.vue | 8 +- litemall-admin/src/views/goods/goods.vue | 6 +- litemall-admin/src/views/goods/product.vue | 9 +- .../src/views/goods/specification.vue | 8 +- litemall-admin/src/views/mall/brand.vue | 8 +- litemall-admin/src/views/mall/category.vue | 8 +- litemall-admin/src/views/mall/issue.vue | 8 +- litemall-admin/src/views/mall/keyword.vue | 8 +- litemall-admin/src/views/mall/order.vue | 8 +- litemall-admin/src/views/mall/region.vue | 8 +- litemall-admin/src/views/promotion/ad.vue | 8 +- litemall-admin/src/views/promotion/topic.vue | 8 +- litemall-admin/src/views/sys/admin.vue | 8 +- litemall-admin/src/views/sys/os.vue | 8 +- litemall-admin/src/views/user/address.vue | 8 +- litemall-admin/src/views/user/collect.vue | 8 +- litemall-admin/src/views/user/footprint.vue | 8 +- litemall-admin/src/views/user/history.vue | 8 +- litemall-admin/src/views/user/user.vue | 8 +- 24 files changed, 40 insertions(+), 291 deletions(-) delete mode 100644 litemall-admin/src/directive/sticky.js delete mode 100644 litemall-admin/src/directive/waves/index.js delete mode 100644 litemall-admin/src/directive/waves/waves.css delete mode 100644 litemall-admin/src/directive/waves/waves.js diff --git a/litemall-admin/src/directive/sticky.js b/litemall-admin/src/directive/sticky.js deleted file mode 100644 index bc234660..00000000 --- a/litemall-admin/src/directive/sticky.js +++ /dev/null @@ -1,91 +0,0 @@ -const vueSticky = {} -let listenAction -vueSticky.install = Vue => { - Vue.directive('sticky', { - inserted(el, binding) { - const params = binding.value || {} - const stickyTop = params.stickyTop || 0 - const zIndex = params.zIndex || 1000 - const elStyle = el.style - - elStyle.position = '-webkit-sticky' - elStyle.position = 'sticky' - // if the browser support css sticky(Currently Safari, Firefox and Chrome Canary) - // if (~elStyle.position.indexOf('sticky')) { - // elStyle.top = `${stickyTop}px`; - // elStyle.zIndex = zIndex; - // return - // } - const elHeight = el.getBoundingClientRect().height - const elWidth = el.getBoundingClientRect().width - elStyle.cssText = `top: ${stickyTop}px; z-index: ${zIndex}` - - const parentElm = el.parentNode || document.documentElement - const placeholder = document.createElement('div') - placeholder.style.display = 'none' - placeholder.style.width = `${elWidth}px` - placeholder.style.height = `${elHeight}px` - parentElm.insertBefore(placeholder, el) - - let active = false - - const getScroll = (target, top) => { - const prop = top ? 'pageYOffset' : 'pageXOffset' - const method = top ? 'scrollTop' : 'scrollLeft' - let ret = target[prop] - if (typeof ret !== 'number') { - ret = window.document.documentElement[method] - } - return ret - } - - const sticky = () => { - if (active) { - return - } - if (!elStyle.height) { - elStyle.height = `${el.offsetHeight}px` - } - - elStyle.position = 'fixed' - elStyle.width = `${elWidth}px` - placeholder.style.display = 'inline-block' - active = true - } - - const reset = () => { - if (!active) { - return - } - - elStyle.position = '' - placeholder.style.display = 'none' - active = false - } - - const check = () => { - const scrollTop = getScroll(window, true) - const offsetTop = el.getBoundingClientRect().top - if (offsetTop < stickyTop) { - sticky() - } else { - if (scrollTop < elHeight + stickyTop) { - reset() - } - } - } - listenAction = () => { - check() - } - - window.addEventListener('scroll', listenAction) - }, - - unbind() { - window.removeEventListener('scroll', listenAction) - } - }) -} - -export default vueSticky - diff --git a/litemall-admin/src/directive/waves/index.js b/litemall-admin/src/directive/waves/index.js deleted file mode 100644 index 65f9b308..00000000 --- a/litemall-admin/src/directive/waves/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import waves from './waves' - -const install = function(Vue) { - Vue.directive('waves', waves) -} - -if (window.Vue) { - window.waves = waves - Vue.use(install); // eslint-disable-line -} - -waves.install = install -export default waves diff --git a/litemall-admin/src/directive/waves/waves.css b/litemall-admin/src/directive/waves/waves.css deleted file mode 100644 index af7a7efd..00000000 --- a/litemall-admin/src/directive/waves/waves.css +++ /dev/null @@ -1,26 +0,0 @@ -.waves-ripple { - position: absolute; - border-radius: 100%; - background-color: rgba(0, 0, 0, 0.15); - background-clip: padding-box; - pointer-events: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -webkit-transform: scale(0); - -ms-transform: scale(0); - transform: scale(0); - opacity: 1; -} - -.waves-ripple.z-active { - opacity: 0; - -webkit-transform: scale(2); - -ms-transform: scale(2); - transform: scale(2); - -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out; - transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out; - transition: opacity 1.2s ease-out, transform 0.6s ease-out; - transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out; -} \ No newline at end of file diff --git a/litemall-admin/src/directive/waves/waves.js b/litemall-admin/src/directive/waves/waves.js deleted file mode 100644 index ac1d8611..00000000 --- a/litemall-admin/src/directive/waves/waves.js +++ /dev/null @@ -1,42 +0,0 @@ -import './waves.css' - -export default{ - bind(el, binding) { - el.addEventListener('click', e => { - const customOpts = Object.assign({}, binding.value) - const opts = Object.assign({ - ele: el, // 波纹作用元素 - type: 'hit', // hit点击位置扩散center中心点扩展 - color: 'rgba(0, 0, 0, 0.15)' // 波纹颜色 - }, customOpts) - const target = opts.ele - if (target) { - target.style.position = 'relative' - target.style.overflow = 'hidden' - const rect = target.getBoundingClientRect() - let ripple = target.querySelector('.waves-ripple') - if (!ripple) { - ripple = document.createElement('span') - ripple.className = 'waves-ripple' - ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px' - target.appendChild(ripple) - } else { - ripple.className = 'waves-ripple' - } - switch (opts.type) { - case 'center': - ripple.style.top = (rect.height / 2 - ripple.offsetHeight / 2) + 'px' - ripple.style.left = (rect.width / 2 - ripple.offsetWidth / 2) + 'px' - break - default: - ripple.style.top = (e.pageY - rect.top - ripple.offsetHeight / 2 - document.body.scrollTop) + 'px' - ripple.style.left = (e.pageX - rect.left - ripple.offsetWidth / 2 - document.body.scrollLeft) + 'px' - } - ripple.style.backgroundColor = opts.color - ripple.className = 'waves-ripple z-active' - return false - } - }, false) - } -} - diff --git a/litemall-admin/src/views/goods/attribute.vue b/litemall-admin/src/views/goods/attribute.vue index 1544c1c5..a8562cbb 100644 --- a/litemall-admin/src/views/goods/attribute.vue +++ b/litemall-admin/src/views/goods/attribute.vue @@ -5,9 +5,9 @@
- 查找 + 查找 添加 - 导出 + 导出
@@ -64,13 +64,9 @@