diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..0a5be2b4f6b1e9d0a2d96704d2d8574c68233914 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +unpackage/ +.hbuilderx \ No newline at end of file diff --git a/App.vue b/App.vue new file mode 100644 index 0000000000000000000000000000000000000000..4c403fe98b8b833ba4d40734bfec57264bfeb506 --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/ldcake-ui/.hbuilderx/launch.json b/ldcake-ui/.hbuilderx/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..501e01c82011adf48f71b15a39f056626e5cece5 --- /dev/null +++ b/ldcake-ui/.hbuilderx/launch.json @@ -0,0 +1,11 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "type": "uniCloud", + "default": { + "launchtype": "remote" + } + } + ] +} diff --git a/ldcake-ui/README.md b/ldcake-ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d35c7deda8f2db3568187d45e4546ca87caa896d --- /dev/null +++ b/ldcake-ui/README.md @@ -0,0 +1,73 @@ +

ldcake

+

基于UNI-APP快速开发的组件库

+ + +## 说明 + +ldcake-ui,是基于[uni-app](https://uniapp.dcloud.io/)的UI组件库 + +## 特性 + +- 众多的常用组件,让您专注逻辑,事半功倍 +- 按需引入,精简打包体积 + +## 安装 + +```bash +# npm方式安装 +npm i ldcake-ui +``` + +## 快速上手 + +1. `main.js`引入ldcake库 +```js +// main.js +import ldcake from 'ldcake-ui'; +Vue.use(ldcake); +``` + +2. `App.vue`引入基础样式(注意style标签需声明scss属性支持) +```css +/* App.vue */ + +``` + +3. `uni.scss`引入全局scss变量文件 +```css +/* uni.scss */ +@import "ldcake-ui/theme.scss"; +``` + +4. `pages.json`配置easycom规则(按需引入) + +```js +// pages.json +{ + "easycom": { + // npm安装的方式不需要前面的"@/",下载安装的方式需要"@/" + // npm安装方式 + "^ldc-(.*)": "ldcake-ui/components/ldc-$1/ldc-$1.vue" + // 下载安装方式 + // "^ldc-(.*)": "@/ldcake-ui/components/ldc-$1/ldc-$1.vue" + }, + // 此为本身已有的内容 + "pages": [ + // ...... + ] +} +``` + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +``` + +## 版权信息 +ldcake遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将ldcake应用到您的产品中。 diff --git a/ldcake-ui/components/ldc-date-picker/ldc-date-picker.vue b/ldcake-ui/components/ldc-date-picker/ldc-date-picker.vue new file mode 100644 index 0000000000000000000000000000000000000000..90b33099534304f5e4de8854b66830ede3933952 --- /dev/null +++ b/ldcake-ui/components/ldc-date-picker/ldc-date-picker.vue @@ -0,0 +1,451 @@ + + + + + diff --git a/ldcake-ui/index.js b/ldcake-ui/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8878385a48f5fc265f3e04894f41b40f7a3ca92d --- /dev/null +++ b/ldcake-ui/index.js @@ -0,0 +1,16 @@ +// 主题相关颜色,info|success|warning|primary|default|error,此颜色已在uview.scss中定义,但是为js中也能使用,故也定义一份 +import isEmpty from './libs/utils/isEmpty.js' +import color from './libs/config/color.js' + +const $ldc = { + isEmpty, + color, +} + +const install = Vue => { + Vue.prototype.$ldc = $ldc +} + +export default { + install +} \ No newline at end of file diff --git a/ldcake-ui/libs/config/color.js b/ldcake-ui/libs/config/color.js new file mode 100644 index 0000000000000000000000000000000000000000..dafb8c1c756395e6e71fa3d5cf9cbe1983778263 --- /dev/null +++ b/ldcake-ui/libs/config/color.js @@ -0,0 +1,37 @@ +// 为了让用户能够自定义主题,会逐步弃用此文件,各颜色通过css提供 +// 为了给某些特殊场景使用和向后兼容,无需删除此文件(2020-06-20) +let color = { + primary: "#2979ff", + primaryDark: "#2b85e4", + primaryDisabled: "#a0cfff", + primaryLight: "#ecf5ff", + bgColor: "#f3f4f6", + + info: "#909399", + infoDark: "#82848a", + infoDisabled: "#c8c9cc", + infoLight: "#f4f4f5", + + warning: "#ff9900", + warningDark: "#f29100", + warningDisabled: "#fcbd71", + warningLight: "#fdf6ec", + + error: "#fa3534", + errorDark: "#dd6161", + errorDisabled: "#fab6b6", + errorLight: "#fef0f0", + + success: "#19be6b", + successDark: "#18b566", + successDisabled: "#71d5a1", + successLight: "#dbf1e1", + + mainColor: "#303133", + contentColor: "#606266", + tipsColor: "#909399", + lightColor: "#c0c4cc", + borderColor: "#e4e7ed" +} + +export default color; \ No newline at end of file diff --git a/ldcake-ui/libs/utils/isEmpty.js b/ldcake-ui/libs/utils/isEmpty.js new file mode 100644 index 0000000000000000000000000000000000000000..439496b998283eb0e020d78cfc078e1f3fd0574e --- /dev/null +++ b/ldcake-ui/libs/utils/isEmpty.js @@ -0,0 +1,5 @@ +function isEmpty(val) { + return !(!!val ? typeof val === 'object' ? Array.isArray(val) ? !!val.length : !!Object.keys(val).length : true : false); +} + +export default isEmpty; \ No newline at end of file diff --git a/ldcake-ui/package.json b/ldcake-ui/package.json new file mode 100644 index 0000000000000000000000000000000000000000..da7c5bed5ee33ef723a1463c1af75ea2934d919f --- /dev/null +++ b/ldcake-ui/package.json @@ -0,0 +1,31 @@ +{ + "name": "ldcake-ui", + "version": "1.0.4", + "description": "基于uni-app的UI组件库", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "ldcake", + "ldCake", + "uni-app", + "uni-app ui", + "uniapp", + "ldcakeui", + "ldcake ui", + "ldcakeUI", + "ldCakeui", + "ldCakeUI", + "ldCake UI", + "uni ui", + "uni UI", + "uniapp ui", + "ui", + "UI框架", + "uniapp ui框架", + "uniapp UI" + ], + "author": "icjs", + "license": "MIT" +} diff --git a/ldcake-ui/theme.scss b/ldcake-ui/theme.scss new file mode 100644 index 0000000000000000000000000000000000000000..b7ce9d99a51f0171aa13eddc686819da371ff120 --- /dev/null +++ b/ldcake-ui/theme.scss @@ -0,0 +1,38 @@ +// 此文件为ldcake的主题变量,这些变量目前只能通过uni.scss引入才有效,另外由于 +// uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中,造成微信程序包太大, +// 故uni.scss只建议放scss变量名相关样式,其他的样式可以通过main.js或者App.vue引入 + +$ldc-main-color: #303133; +$ldc-content-color: #606266; +$ldc-tips-color: #909399; +$ldc-light-color: #c0c4cc; +$ldc-border-color: #F2F2F2; +$ldc-bg-color: #f3f4f6; + +$ldc-type-primary: #2979ff; +$ldc-type-primary-light: #ecf5ff; +$ldc-type-primary-dark: #2b85e4; +$ldc-type-primary-disabled: #a0cfff; + +$ldc-type-warning: #ff9900; +$ldc-type-warning-light: #fdf6ec; +$ldc-type-warning-dark: #fcbd71; +$ldc-type-warning-disabled: #ffd283; + +$ldc-type-success: #19be6b; +$ldc-type-success-disabled: #71d5a1; +$ldc-type-success-dark: #18b566; +$ldc-type-success-light: #dbf1e1; + +$ldc-type-error: #fa3534; +$ldc-type-error-disabled: #fab6b6; +$ldc-type-error-dark: #dd6161; +$ldc-type-error-light: #fef0f0; + +$ldc-type-info: #909399; +$ldc-type-info-disabled: #c8c9cc; +$ldc-type-info-dark: #82848a; +$ldc-type-info-light: #f4f4f5; + +$ldc-form-item-height: 70rpx; +$ldc-form-item-border-color: #dcdfe6; diff --git a/main.js b/main.js new file mode 100644 index 0000000000000000000000000000000000000000..bd6d900956c2a9730fc690d552a0386427c32b73 --- /dev/null +++ b/main.js @@ -0,0 +1,13 @@ +import Vue from 'vue' +import App from './App' +import ldcake from "ldcake-ui" + +Vue.config.productionTip = false +Vue.use(ldcake) + +App.mpType = 'app' + +const app = new Vue({ + ...App +}) +app.$mount() diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..268e72bebb888cb560e178142615bf7bbd51161d --- /dev/null +++ b/manifest.json @@ -0,0 +1,75 @@ +{ + "name" : "ldcake-uniapp", + "appid" : "__UNI__9437254", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "h5" : { + "title" : "绿豆糕组件库", + "domain" : "" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000000000000000000000000000000000000..19701b135e7115050a8cb411a6249a9910e1d6e1 --- /dev/null +++ b/pages.json @@ -0,0 +1,28 @@ +{ + "easycom": { + "^ldc-(.*)": "@/ldcake-ui/components/ldc-$1/ldc-$1.vue" + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "ldcake-uniapp" + } + } + ,{ + "path" : "pages/components/date-picker/date-picker", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + } +} diff --git a/pages/components/date-picker/date-picker.vue b/pages/components/date-picker/date-picker.vue new file mode 100644 index 0000000000000000000000000000000000000000..f9b7265d16d4de3fb84fa575ce49f226b7b38715 --- /dev/null +++ b/pages/components/date-picker/date-picker.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..a2c22dd9b878c877dba918ae612df0e80b09b495 --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,18 @@ + + + + + diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b5771e209bb677e2ebd5ff766ad5ee11790f305a Binary files /dev/null and b/static/logo.png differ diff --git a/styles/demo.scss b/styles/demo.scss new file mode 100644 index 0000000000000000000000000000000000000000..ac3520f9b70d7c964ad5243213641e48d61373a8 --- /dev/null +++ b/styles/demo.scss @@ -0,0 +1,86 @@ +/* #ifndef APP-NVUE */ +view, +text { + box-sizing: border-box; +} +/* #endif */ + +/* start--演示页面使用的统一样式--start */ +.ldc-demo { + padding: 25px 20px; +} + +.ldc-demo-wrap { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + background-color: rgb(250, 250, 250); + padding: 20px 10px; + border-radius: 3px; +} + +.ldc-demo-area { + text-align: center; +} + +.ldc-no-demo-here { + color: $ldc-tips-color; + font-size: 13px; +} + +.ldc-demo-result-line { + border-width: 1px; + border-color: #ddd; + border-style: dashed; + padding: 5px 20px; + margin-top: 30px; + border-radius: 5px; + background-color: rgb(240, 240, 240); + color: $ldc-content-color; + font-size: 16px; + /* #ifndef APP-NVUE */ + word-break: break-word; + display: inline-block; + /* #endif */ + text-align: left; + +} + +.ldc-demo-title, +.ldc-config-title { + text-align: center; + font-size: 16px; + font-weight: bold; + margin-bottom: 20px; +} + +.ldc-config-item { + margin-top: 25px; +} + +.ldc-config-title { + margin-top: 20px; + padding-bottom: 5px; +} + +.ldc-item-title { + position: relative; + font-size: 15px; + padding-left: 8px; + line-height: 1; + margin-bottom: 11px; +} + +.ldc-item-title:after { + position: absolute; + width: 4px; + top: -1px; + height: 16px; + /* #ifndef APP-NVUE */ + content: ''; + /* #endif */ + left: 0; + border-radius: 10px; + background-color: $ldc-content-color; +} +/* end--演示页面使用的统一样式--end */ \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000000000000000000000000000000000000..85e02c4a2c59d14c93adce14454ec1c4efaee54e --- /dev/null +++ b/uni.scss @@ -0,0 +1,79 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color:#333;//基本色 +$uni-text-color-inverse:#fff;//反色 +$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable:#c0c0c0; + +/* 背景颜色 */ +$uni-bg-color:#ffffff; +$uni-bg-color-grey:#f8f8f8; +$uni-bg-color-hover:#f1f1f1;//点击状态颜色 +$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色 + +/* 边框颜色 */ +$uni-border-color:#c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm:24rpx; +$uni-font-size-base:28rpx; +$uni-font-size-lg:32rpx; + +/* 图片尺寸 */ +$uni-img-size-sm:40rpx; +$uni-img-size-base:52rpx; +$uni-img-size-lg:80rpx; + +/* Border Radius */ +$uni-border-radius-sm: 4rpx; +$uni-border-radius-base: 6rpx; +$uni-border-radius-lg: 12rpx; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 10px; +$uni-spacing-row-base: 20rpx; +$uni-spacing-row-lg: 30rpx; + +/* 垂直间距 */ +$uni-spacing-col-sm: 8rpx; +$uni-spacing-col-base: 16rpx; +$uni-spacing-col-lg: 24rpx; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:40rpx; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:36rpx; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:30rpx; + +// uView 样式应用 +@import 'ldcake-ui/theme.scss'; \ No newline at end of file