项目作者: zhangyuan123

项目描述 :
一款uni-app 同时结合“文晓港”开发的colorUI微信小程序UI组件库
高级语言: Vue
项目地址: git://github.com/zhangyuan123/uniApp-colorUI.git
创建时间: 2020-03-09T11:22:03Z
项目社区:https://github.com/zhangyuan123/uniApp-colorUI

开源协议:

下载


uniApp-colorUI

一款uni-app 同时结合“文晓港”开发的colorUI微信小程序UI组件库

colorUI cover by “文晓港”

uniApp结合colorUI

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

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

/每个页面公共css /

@import url("colorui/main.css");

@import url("colorui/icon.css");

使用自定义导航栏

自定义导航栏组件可以使开发者更灵活地进行个性化开发

获取系统信息(App.vue)

  1. onLaunch: function() {
  2. uni.getSystemInfo({
  3. success: function(e) {
  4. // #ifndef MP
  5. Vue.prototype.StatusBar = e.statusBarHeight;
  6. if (e.platform == 'android') {
  7. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  8. } else {
  9. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  10. };
  11. // #endif
  12. // #ifdef MP
  13. Vue.prototype.StatusBar = e.statusBarHeight;
  14. let custom = wx.getMenuButtonBoundingClientRect();
  15. Vue.prototype.Custom = custom;
  16. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  17. // #endif
  18. }
  19. })
  20. },

取消系统导航栏配置(page.json)

"navigationStyle": "custom"

组件已封装,直接在main.js中引入并声明

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

页面直接调用即可

1、显示返回按钮及返回首页图标

  1. <cu-custom bgColor='bg-gradual-pink' isCustom='ture'>
  2. <view slot='content'>操作条</view>
  3. </cu-custom>

2、显示返回按钮和返回文字

  1. <cu-custom bgColor='bg-gradual-blue' isBack='ture'>
  2. <view slot='backText'>返回</view>
  3. <view slot='content'>背景</view>
  4. </cu-custom>