mjz update

This commit is contained in:
mjz
2023-05-28 18:15:33 +08:00
parent 9b75e60571
commit ed6e2d81fb
243 changed files with 11730 additions and 6 deletions
@@ -0,0 +1,28 @@
---
title: 介绍
date: 2023-05-28 09:51:38
permalink: /pages/base
article: false
---
::: tip 温馨提示
本文档并非是官方文档,而是本人自己经常使用 Color UI,但是又找不到一个满意的文档,不如自己搭建一个文档,自己使用方便的同时也方便大家使用
:::
## 基本介绍
Color UI 我想大家都知晓吧,我就不过多阐述了,是 **文晓港** 大佬开发的一款适应于H5、微信小程序、安卓、ios、支付宝的高颜值,高度自定义的 Css 组件库.,属于出道即巅峰的史诗级大作,众所周知,万物皆可 Color UI,很多人用 Color UI 做了不少精美的项目,我也一样,在此再次感谢作者。
[ColorUI Github地址](https://github.com/weilanwl/ColorUI)
[ColorUI 插件市场](https://ext.dcloud.net.cn/plugin?id=239)
## 文档说明
文档左侧目录,基础元素、交互组件、插件扩展分别对应,Color UI 底部对应的三个大模块,而三个模块下二级目录,也分别对应三个页面里的模块,点击目录右侧会跳转到对应的页面。
每一个页面,会分别将对应的代码块展示出来,部分对应的页面最下方点击**点此查看页面原代码**即可查看对应页面的完整代码。
### 视图/目录 切换
点击h5预览模板左上角的切换视图,可以切换目录/视图
@@ -0,0 +1,179 @@
---
title: 快速使用
date: 2023-05-28 10:28:38
permalink: /pages/baseStart
article: false
---
## 素材
ColorUI在语雀有个群友共同在维护的知识库,里面有一些群友改的模板和UI素材供开发使用哦! [语雀-ColorUI群资源](https://www.yuque.com/colorui)
## 前言
ColorUI是一个css库!!!在你引入样式后可以根据class来调用组件,一些含有交互的操作我也有简单写,可以为你开发提供一些思路。
## 交流
微信群:加入微信群请先添加开发者微信,备注UniApp插件市场。QQ群:240787041 或扫描二维码。
[![img](https://camo.githubusercontent.com/f686814edb071f1cce9f0401a5fd487c4f64b5aa8e981f080b04f255e21199c9/68747470733a2f2f636f732e636f6c6f722d75692e636f6d2f7765622f6b6d346a732e706e67)](https://camo.githubusercontent.com/f686814edb071f1cce9f0401a5fd487c4f64b5aa8e981f080b04f255e21199c9/68747470733a2f2f636f732e636f6c6f722d75692e636f6d2f7765622f6b6d346a732e706e67)
## 使用UniApp开发
### 开始
下载源码解压获得`/Colorui-UniApp`文件夹,复制目录下的 `/colorui` 文件夹到你的项目根目录
```vue
App.vue` 引入关键Css `main.css` `icon.css
<style>
@import "colorui/main.css";
@import "colorui/icon.css";
@import "app.css"; /* 你的项目css */
....
</style>
```
### 使用自定义导航栏
导航栏作为常用组件有做简单封装,当然你也可以直接复制代码结构自己修改,达到个性化目的。
`App.vue` 获得系统信息
```js
onLaunch: function() {
uni.getSystemInfo({
success: function(e) {
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
};
// #endif
// #ifdef MP-WEIXIN
Vue.prototype.StatusBar = e.statusBarHeight;
let custom = wx.getMenuButtonBoundingClientRect();
Vue.prototype.Custom = custom;
Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif
// #ifdef MP-ALIPAY
Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// #endif
}
})
},
```
`pages.json` 配置取消系统导航栏
```js
"globalStyle": {
"navigationStyle": "custom"
},
```
复制代码结构可以直接使用,注意全局变量的获取。
使用封装,在`main.js` 引入 `cu-custom` 组件。
```js
import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)
```
`page.vue` 页面可以直接调用了
```vue
<cu-custom bgColor="bg-gradual-blue" :isBack="true">
<block slot="backText">返回</block>
<block slot="content">导航栏</block>
</cu-custom>
```
| 参数 | 作用 | 类型 | 默认值 |
| ------- | ------------ | ------- | ------ |
| bgColor | 背景颜色类名 | String | '' |
| isBack | 是否开启返回 | Boolean | false |
| bgImage | 背景图片路径 | String | '' |
| slot块 | 作用 |
| -------- | ---------------------------------- |
| backText | 返回时的文字 |
| content | 中间区域 |
| right | 右侧区域(小程序端可使用范围很窄!) |
## 使用原生小程序开发
### 从现有项目开始
下载源码解压获得`/demo`,复制目录下的 `/colorui` 文件夹到你的项目根目录
```
App.wxss` 引入关键Css `main.wxss` `icon.wxss
@import "colorui/main.wxss";
@import "colorui/icon.wxss";
@import "app.css"; /* 你的项目css */
....
```
### 从新项目开始
下载源码解压获得`/template`,复制`/template`并重命名为你的项目,导入到小程序开发工具既可以开始你的新项目了
### 使用自定义导航栏
导航栏作为常用组件有做简单封装,当然你也可以直接复制代码结构自己修改,达到个性化目的。
`App.js` 获得系统信息
```
onLaunch: function() {
wx.getSystemInfo({
success: e => {
this.globalData.StatusBar = e.statusBarHeight;
let custom = wx.getMenuButtonBoundingClientRect();
this.globalData.Custom = custom;
this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
}
})
},
```
`App.json` 配置取消系统导航栏,并全局引入组件
```
"window": {
"navigationStyle": "custom"
},
"usingComponents": {
"cu-custom":"/colorui/components/cu-custom"
}
```
`page.wxml` 页面可以直接调用了
```
<cu-custom bgColor="bg-gradual-pink" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">导航栏</view>
</cu-custom>
```
| 参数 | 作用 | 类型 | 默认值 |
| -------- | ---------------- | ------- | ------ |
| bgColor | 背景颜色类名 | String | '' |
| isBack | 是否开启返回 | Boolean | false |
| isCustom | 是否开启左侧胶囊 | Boolean | false |
| bgImage | 背景图片路径 | String | '' |
| slot块 | 作用 |
| -------- | ---------------------------------- |
| backText | 返回时的文字 |
| content | 中间区域 |
| right | 右侧区域(小程序端可使用范围很窄!) |