GithubHelp home page GithubHelp logo

weilanwl / colorui Goto Github PK

View Code? Open in Web Editor NEW
12.1K 252.0 2.2K 6.95 MB

鲜亮的高饱和色彩,专注视觉的小程序组件库

Home Page: https://www.color-ui.com/

License: MIT License

JavaScript 1.51% Vue 54.59% CSS 43.90%
css mp-weixin scss uniapp vue vue2

colorui's Introduction

V3 测试版:https://github.com/weilanwl/coloruiBeta

ColorUI简介

素材

ColorUI在语雀有个群友共同在维护的知识库,里面有一些群友改的模板和UI素材供开发使用哦! 语雀-ColorUI群资源

前言

ColorUI是一个css库!!!在你引入样式后可以根据class来调用组件,一些含有交互的操作我也有简单写,可以为你开发提供一些思路。

交流

微信群:加入微信群请先添加开发者微信,备注UniApp插件市场。QQ群:240787041 或扫描二维码。

使用UniApp开发

开始

下载源码解压获得/Colorui-UniApp文件夹,复制目录下的 /colorui 文件夹到你的项目根目录

App.vue 引入关键Css main.css icon.css

<style>
@import "colorui/main.css";
@import "colorui/icon.css";
@import "app.css"; /* 你的项目css */
....
</style>

使用自定义导航栏

导航栏作为常用组件有做简单封装,当然你也可以直接复制代码结构自己修改,达到个性化目的。

App.vue 获得系统信息

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 配置取消系统导航栏

"globalStyle": {
  "navigationStyle": "custom"
},

复制代码结构可以直接使用,注意全局变量的获取。

使用封装,在main.js 引入 cu-custom 组件。

import cuCustom from './colorui/components/cu-custom.vue'
Vue.component('cu-custom',cuCustom)

page.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 右侧区域(小程序端可使用范围很窄!)

赞赏

License

MIT

Copyright (c) 2020-present, XiaoGang Wen

colorui's People

Contributors

wen-gang avatar xiaohuilam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colorui's Issues

新组件需求 - 拖拽组件

很多时候,一个列表里面的item需要进行排序,如果能提供组件的拖拽功能,item就能自由进行排序,谢谢

关于字体图标的建议

页面样式做得很棒,但是,给一个小小的建议。

由于 ColorUI 是一个几乎纯 CSS 的库,那么有时为了达到我们自己产品的需求,需要引用其它的库。
大的方向倒是没有什么,只是在字体图标上面:

很多库都用了 iconfont,那么,他们的 font-family 全部是都是 iconfont

所以,我建议:font-family 设置成自己的名称,比如:

// icon.wxss
[class*="icon-"] {
    font-family: "cufont" !important;   // 修改此行
    font-size: ...
    ...
}

@font-face {
    font-family: "cufont";   // 修改此行
    src: ...
    ...
}

// colorui.wxss 中所有用到 iconfont 的地方,比如:
image.loading::after {
    content: "\e7f1";
    font-family: "cufont";   // 修改此行
    position: ...
    ...
}

设置成上述名称后,比较能够保证图标的独立性,避免因为 content 和别人冲突后,被覆盖的问题。尤其是那些含有 js 组件的类库,几乎都是后加载的,一般都会覆盖 wxss。

colorui.wxss里全是!important

我自己想修改一些东西,改了半天发现没用,后面发现有!important,以致于我要再写个!important覆盖才行,不能按照CSS正常的层叠的优先级,然后我在colorui.wxss里搜索!important关键字,发现匹配166个,就是说基本全篇都是,能不能把这些去掉呢?

https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
里面也说了:“Never use !important when you're writing a plugin/mashup.”
你们作为第三方组件库,应该要避免这种情况吧?

icon标签失效

项目引入colorui后 <icon> 标签就都失效了。
目前是我把[class*="icon-"] 改成 [class*="iconfont-"] 其它 icon- 也都相应改成 iconfont- 就好了。

.solid 子元素点击事件无效

代码如下
test.wxml

<view class="solid box">
  <button bindtap="clickConsole" class="btn primary">测试 solid </button>
</view>

test.js

Page({
  clickConsole: function() {
    console.log('click!');
  }
})

css也能导致按钮的bindtap事件失效,发现把.solid::after的宽度高度设为100%就可以了,或者加上pointer-events: none

.solid::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    content: " ";
    -webkit-transform: scale(.5);
    transform: scale(.5);
    -webkit-transform-origin: 0 0;
    transform-origin: 0 0;
    pointer-events: none
}

就一个问题

首先做的很不错
其次,这套wxss样式只能用在page层级
在自定义组件的wxml中基本无法使用
自定义组件的wxss中诸多的选择器限制是个麻烦

模态窗口的侧边抽屉高度不对

模态窗口的侧边抽屉高度不对,忘记减掉顶部导航栏的高度(并且好多底部的功能栏没有兼容iPhoneX,iPhoneX底部有34px的安全区)
img_0841
img_0842

做的非常不错

建议
1、出一个文档
2、弹框的比较马虎,需要细节化一下。
3、希望能类似于PC一样 有一个公共核心 css(wxss)库,
我看过很多开源的UI框架,都喜欢写成一个一个组件,可能很多时候 别人用不着这些组件,他们需要一个核心的样式库而已。

总体来说,非常棒。 出个文档就很好了、

不支持控件

在控件中使用
@import '/path/to/colorui/colorui.wxss';

会报错
Some selectors are not allowed in component wxss, including tag name selectors, ID selectors, and attribute selectors

so cool

界面也太漂亮了趴!膜拜大佬,可以请教大佬后端该怎么搞吗

组件-form表单选择图标点击区域

组件-form表单选择组件右边的图标点击无效。
picker组件因为padding的关系,导致了右边图标附近的区域都是无法响应点击事件的,有强迫症的无法忍受,希望能完善这个问题,谢谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.