高顏值的小程序組件庫,值得推薦——ColorUI

2020-02-02     最美分享Coder

介紹

ColorUI是一個高飽和度色彩,注重視覺效果的小程序組件庫,可以在國內比較火的uniapp或者原生小程序中進行開發。文章中將進行各組件的截圖預覽,一定不會讓你失望的!




PS:想直接查看組件效果的小夥伴可直接跳到組件預覽標題


Github

https://github.com/weilanwl/ColorUI

語雀知識庫

https://www.yuque.com/colorui

PS:語雀是一個適合個人和團隊的高質量文檔知識管理庫

在Uniapp中開發

在最新版本的HBuilderX開發工具中已經自帶了項目模板,可以通過這個項目模板進行開發,當然也可以單獨使用


下面是不通過模板單獨引入

下載源碼解壓獲得/Colorui-UniApp文件夾,複製目錄下的 /colorui 文件夾到你的項目根目錄

App.vue 引入關鍵Css main.css icon.css

  • 使用自定義導航欄

導航欄作為常用組件有做簡單封裝,當然你也可以直接複製代碼結構自己修改,達到個性化目的。

App.vue 獲得系統信息

onLaunch: function() {uni.getSystemInfo({success: function(e) {// #ifndef MPVue.prototype.StatusBar = e.statusBarHeight;if (e.platform == 'android') {Vue.prototype.CustomBar = e.statusBarHeight + 50;} else {Vue.prototype.CustomBar = e.statusBarHeight + 45;};// #endif// #ifdef MP-WEIXINVue.prototype.StatusBar = e.statusBarHeight;let custom = wx.getMenuButtonBoundingClientRect();Vue.prototype.Custom = custom;Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;// #endif// #ifdef MP-ALIPAYVue.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 頁面可以直接調用了

返回導航欄

原生使用

下載源碼解壓獲得/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 頁面可以直接調用了

返回導航欄

組件預覽

  • 基礎元素部分













  • 交互組件













  • 擴展插件






總結

以上就是幾乎所有的ColorUI組件,感興趣的可以直接查看官方demo,顏值相當高!enjoy it!

文章來源: https://twgreatdaily.com/Bp8gCHAB3uTiws8KImqD.html