From 1a1f189e71ce9c6657ffe728479ff09c0b402a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E6=9C=AF?= Date: Sat, 24 Apr 2021 01:03:30 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ldcake-ui/index.js | 2 ++ ldcake-ui/libs/utils/clipboard.js | 31 +++++++++++++++++++++++++++++++ ldcake-ui/package.json | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 ldcake-ui/libs/utils/clipboard.js diff --git a/ldcake-ui/index.js b/ldcake-ui/index.js index 650ac63..7015704 100644 --- a/ldcake-ui/index.js +++ b/ldcake-ui/index.js @@ -1,10 +1,12 @@ import color from './libs/config/color.js' import common from './libs/utils/common.js' +import clipboard from './libs/utils/clipboard.js' import cache from './libs/utils/cache.js' import storage from './libs/utils/storage.js' const $c = { color, ...common, + ...clipboard, ...storage, ...cache, } diff --git a/ldcake-ui/libs/utils/clipboard.js b/ldcake-ui/libs/utils/clipboard.js new file mode 100644 index 0000000..6e0ca20 --- /dev/null +++ b/ldcake-ui/libs/utils/clipboard.js @@ -0,0 +1,31 @@ +export const setClipboardData = (content) => { + // #ifdef H5 + try{ + let textarea = document.createElement("textarea") + textarea.value = content + textarea.readOnly = "readOnly" + document.body.appendChild(textarea) + textarea.select() // 选择对象 + textarea.setSelectionRange(0, content.length) //核心 + let result = document.execCommand("Copy") // 执行浏览器复制命令 + textarea.remove() + uni.showToast({ + title: '内容已复制', + icon: 'none', + duration: 2000 + }); + return result + }catch(e){ + return null + } + // #endif + // #ifndef H5 + uni.setClipboardData({ + data: content + }); + // #endif +} + +export default { + setClipboardData +} \ No newline at end of file diff --git a/ldcake-ui/package.json b/ldcake-ui/package.json index 9d5b2db..55d08d7 100644 --- a/ldcake-ui/package.json +++ b/ldcake-ui/package.json @@ -1,6 +1,6 @@ { "name": "ldcake-ui", - "version": "1.0.11", + "version": "1.0.12", "description": "基于uni-app的UI组件库", "main": "index.js", "scripts": { -- Gitee From 76b91b92db6bc218a707e28503e03dafcce3cbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E6=9C=AF?= Date: Sat, 24 Apr 2021 01:05:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=A8=20=E4=BF=AE=E6=94=B9=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E8=83=8C=E6=99=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 96 +++++++++++++++++++------------------------ pages/index/index.vue | 2 +- 2 files changed, 43 insertions(+), 55 deletions(-) diff --git a/pages.json b/pages.json index 8cac2be..e36e6de 100644 --- a/pages.json +++ b/pages.json @@ -2,63 +2,51 @@ "easycom": { "^c-(.*)": "@/ldcake-ui/components/c-$1/c-$1.vue" }, - "pages": [ - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "绿豆糕组件库" - } + "pages": [{ + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "绿豆糕组件库" } - ,{ - "path" : "pages/components/date-picker/date-picker", - "style" : - { - "navigationBarTitleText": "日期选择器(date-picker)", - "enablePullDownRefresh": false - } - - } - ,{ - "path" : "pages/components/spin/spin", - "style" : - { - "navigationBarTitleText": "Spin(加载中)", - "enablePullDownRefresh": false - } - - } - ,{ - "path" : "pages/components/fabutton/fabutton", - "style" : - { - "navigationBarTitleText": "悬浮按钮(fabutton)", - "enablePullDownRefresh": false - } - - } - ,{ - "path" : "pages/components/mp-tips/mp-tips", - "style" : - { - "navigationBarTitleText": "右上角引导(mp-tips)", - "enablePullDownRefresh": false - } - - } - ,{ - "path" : "pages/components/captcha/captcha", - "style" : - { - "navigationBarTitleText": "获取验证码(captcha)", - "enablePullDownRefresh": false - } - - } - ], + }, { + "path": "pages/components/date-picker/date-picker", + "style": { + "navigationBarTitleText": "日期选择器(date-picker)", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/components/spin/spin", + "style": { + "navigationBarTitleText": "Spin(加载中)", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/components/fabutton/fabutton", + "style": { + "navigationBarTitleText": "悬浮按钮(fabutton)", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/components/mp-tips/mp-tips", + "style": { + "navigationBarTitleText": "右上角引导(mp-tips)", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/components/captcha/captcha", + "style": { + "navigationBarTitleText": "获取验证码(captcha)", + "enablePullDownRefresh": false + } + + }], "globalStyle": { "navigationBarTextStyle": "black", "navigationBarTitleText": "绿豆糕组件库", - "navigationBarBackgroundColor": "#F8F8F8", - "backgroundColor": "#F8F8F8" + "navigationBarBackgroundColor": "#FFFFFF", + "backgroundColor": "#FFFFFF" } } diff --git a/pages/index/index.vue b/pages/index/index.vue index d9ac6bb..8e3f0cd 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -47,7 +47,7 @@ }, ], } - } + }, } -- Gitee From a683ae7213707fa07dae1d13156b7c70e3419ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E6=9C=AF?= Date: Sat, 8 May 2021 20:58:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8=20=E6=9B=B4=E6=96=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ldcake-ui/libs/utils/cache.js | 6 +++--- ldcake-ui/libs/utils/storage.js | 7 ++++--- pages/components/date-picker/date-picker.vue | 4 ++-- pages/index/index.vue | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ldcake-ui/libs/utils/cache.js b/ldcake-ui/libs/utils/cache.js index f31e73c..17b10f8 100644 --- a/ldcake-ui/libs/utils/cache.js +++ b/ldcake-ui/libs/utils/cache.js @@ -16,9 +16,9 @@ let dtime = '_deadtime' export const setCache = (k, v, t) => { const key = getCacheKey(k) setStorage(key, v) - var seconds = parseInt(t) + let seconds = parseInt(t) if (seconds > 0) { - var timestamp = Date.parse(new Date()) + let timestamp = Date.parse(new Date()) timestamp = timestamp / 1000 + seconds setStorage(`${key}${dtime}`.toUpperCase(), `${timestamp}`) } else { @@ -56,7 +56,7 @@ export const getCache = (k, def) => { export const removeCache = (k) => { const key = getCacheKey(k) removeStorage(key) - removeStorage(`${key}dtime`.toUpperCase()) + removeStorage(`${key}${dtime}`.toUpperCase()) } // 清除cache diff --git a/ldcake-ui/libs/utils/storage.js b/ldcake-ui/libs/utils/storage.js index d88cf23..40436a1 100644 --- a/ldcake-ui/libs/utils/storage.js +++ b/ldcake-ui/libs/utils/storage.js @@ -1,4 +1,4 @@ -const config = require('../config/index') +import config from '../config/index' export const getStorageInfo = () => { return uni.getStorageInfoSync() @@ -14,8 +14,9 @@ export const getStorage = (k) => { return uni.getStorageSync(key) } -export const removeStorage = () => { - return uni.removeStorageSync() +export const removeStorage = (k) => { + const key = getStorageKey(k) + return uni.removeStorageSync(key) } export const clearStorage = () => { diff --git a/pages/components/date-picker/date-picker.vue b/pages/components/date-picker/date-picker.vue index de65f83..2c1a7aa 100644 --- a/pages/components/date-picker/date-picker.vue +++ b/pages/components/date-picker/date-picker.vue @@ -6,7 +6,7 @@ date-picker值:{{ result[0]||'' }} {{ result[1]||'' }} - + @@ -14,7 +14,7 @@ export default { data() { return { - result: [], + result: ['2021-01-01', '2021-02-01'], isShow: false, } }, diff --git a/pages/index/index.vue b/pages/index/index.vue index 8e3f0cd..d9ac6bb 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -47,7 +47,7 @@ }, ], } - }, + } } -- Gitee From 9923366e987b85407cd196ace86600492aca2112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E6=9C=AF?= Date: Sat, 8 May 2021 20:59:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=AA=90=20=E6=9B=B4=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ldcake-ui/libs/config/index.js | 2 +- ldcake-ui/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ldcake-ui/libs/config/index.js b/ldcake-ui/libs/config/index.js index 5150b8e..02fcf90 100644 --- a/ldcake-ui/libs/config/index.js +++ b/ldcake-ui/libs/config/index.js @@ -1,4 +1,4 @@ -let version = '1.0.6'; +let version = '1.0.13'; export default { name: 'ldcake', diff --git a/ldcake-ui/package.json b/ldcake-ui/package.json index 55d08d7..aebd427 100644 --- a/ldcake-ui/package.json +++ b/ldcake-ui/package.json @@ -1,6 +1,6 @@ { "name": "ldcake-ui", - "version": "1.0.12", + "version": "1.0.13", "description": "基于uni-app的UI组件库", "main": "index.js", "scripts": { -- Gitee