diff --git a/src/components/TodoList/index.scss b/src/components/TodoList/index.scss index 071bf1de..5fc9e4b5 100644 --- a/src/components/TodoList/index.scss +++ b/src/components/TodoList/index.scss @@ -246,7 +246,7 @@ list-style: none; position: absolute; right: 0; - left: 0; + left: -20px; } .filters li { display: inline; @@ -254,6 +254,7 @@ .filters li a { color: inherit; margin: 3px; + font-size: 12px; padding: 3px 7px; text-decoration: none; border: 1px solid transparent; diff --git a/src/mock/login.js b/src/mock/login.js index fa0f330b..a752d359 100644 --- a/src/mock/login.js +++ b/src/mock/login.js @@ -6,7 +6,7 @@ const userMap = { token: 'admin', introduction: '我是超级管理员', avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', - name: '超级管理员小潘', + name: 'Super Admin', uid: '001' }, editor: { @@ -14,7 +14,7 @@ const userMap = { token: 'editor', introduction: '我是编辑', avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', - name: '普通编辑小张', + name: 'Normal Editor', uid: '002' }, diff --git a/src/utils/index.js b/src/utils/index.js index a011f17e..c1fd062b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -212,3 +212,38 @@ } } + export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result; + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp; + + // 上次被包装函数被调用时间间隔last小于设定时间间隔wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last); + } else { + timeout = null; + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args); + if (!timeout) context = args = null; + } + } + }; + + return function(...args) { + context = this; + timestamp = +new Date(); + const callNow = immediate && !timeout; + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait); + if (callNow) { + result = func.apply(context, args); + context = args = null; + } + + return result; + }; + } + diff --git a/src/views/dashboard/editor/index.vue b/src/views/dashboard/editor/index.vue index c72d9fe0..0da5231f 100644 --- a/src/views/dashboard/editor/index.vue +++ b/src/views/dashboard/editor/index.vue @@ -65,10 +65,10 @@ - + - + @@ -129,10 +129,12 @@ } .display_name{ font-size: 30px; + display: block; } .info-item{ display: inline-block; margin-top: 10px; + font-size: 14px; &:last-of-type{ margin-left: 15px; } diff --git a/src/views/dashboard/editor/lineChart.vue b/src/views/dashboard/editor/lineChart.vue index 7ebd72b0..171c426e 100644 --- a/src/views/dashboard/editor/lineChart.vue +++ b/src/views/dashboard/editor/lineChart.vue @@ -4,6 +4,8 @@