Color-UI 简介及使用教程

这是一个鲜亮的高饱和色彩,专注视觉的小程序组件库 。

ColorUI是一个css库!!!在你引入样式后可以根据class来调用组件,一些含有交互的操作我也有简单写,可以为你开发提供一些思路。需要你引入样式后可以根据class来调用使用。只需要在HTML或wxml标签中加入想要样式的class类名,就可以调用组件库中提前编辑好的样式,大大提高了开发效率。

ColorUI下载地址

使用:

                1.原生微信小程序开发;

                2.UniApp开发;

 原生微信小程序开发

  • 已有项目

下载源码解压获得/demo,复制目录下的 /colorui 文件夹到你的项目的/miniprogram下;

App.wxss 引入关键Css main.wxss icon.wxss

//App.wxss

@import "colorui/main.wxss";
@import "colorui/icon.wxss";
....

使用自定义导航栏

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

App.js 获得系统信息

//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 配置取消系统导航栏,并全局引入组件

//App.json

"window": {
  "navigationStyle": "custom"
},
"usingComponents": {
  "cu-custom":"/colorui/components/cu-custom"
}

page.wxml 页面可以直接调用了

//page.wxml

<cu-custom bgColor="bg-gradual-pink" isBack="{{true}}">
  <view slot="backText">返回</view>
  <view slot="content">导航栏</view>
</cu-custom>
参数作用类型默认值
bgColor背景颜色类名String''
isBack是否开启返回Booleanfalse
isCustom是否开启左侧胶囊Booleanfalse
bgImage背景图片路径String''
slot块作用
backText返回时的文字
content中间区域
right右侧区域(小程序端可使用范围很窄!)

UniApp开发

  • 已有项目

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

 引入关键Css文件 main.css icon.css

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

使用自定义导航栏

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

App.vue 获得系统信息

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

//pages.json

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

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

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

//main.js

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

page.vue 页面可以直接调用了

//page.vue

<cu-custom bgColor="bg-gradual-blue" :isBack="true">
  <block slot="backText">返回</block>
  <block slot="content">导航栏</block>
</cu-custom>
参数作用类型默认值
bgColor背景颜色类名String''
isBack是否开启返回Booleanfalse
bgImage背景图片路径String''
slot块作用
backText返回时的文字
content中间区域
right右侧区域(小程序端可使用范围很窄!)

知识分享还会持续更新,求关注~

  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
好的,我了解了。如果你想去除若依(ruoyi)的UI,可以按照以下步骤进行: 1. 进入若依(ruoyi)的源代码目录,找到 `ruoyi-ui` 文件夹 2. 用文本编辑器打开 `ruoyi-ui` 文件夹下的 `src` 目录下的 `main.js` 文件 3. 在该文件中删除以下代码块: ```javascript import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' Vue.use(ElementUI) ``` 4. 保存并关闭 `main.js` 文件 5. 打开 `ruoyi-ui` 文件夹下的 `src` 目录下的 `App.vue` 文件 6. 在该文件中删除以下代码块: ```html <template> <div id="app"> <router-view/> </div> </template> <script> export default { name: 'App' } </script> <style> #app { font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; margin-top: 60px; } </style> ``` 7. 保存并关闭 `App.vue` 文件 8. 运行 `npm run build` 命令编译打包项目 9. 打开 `ruoyi-ui` 文件夹下的 `dist` 目录,找到生成的 `index.html` 文件 10. 用文本编辑器打开 `index.html` 文件,删除以下代码块: ```html <link href="/static/css/app.8dcf7f7f.css" rel="stylesheet"> <script type="text/javascript" src="/static/js/manifest.1f7d4595.js"></script> <script type="text/javascript" src="/static/js/vendor.7a1b1d27.js"></script> <script type="text/javascript" src="/static/js/app.5b2c8f27.js"></script> ``` 11. 保存并关闭 `index.html` 文件,这样就去除了若依(ruoyi)的UI。 请注意,这只是去除了若依(ruoyi)的UI,不会影响若依(ruoyi)的功能和其他特性。如果你需要使用若依(ruoyi)的UI,可以按照以上步骤恢复。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

洛可可白

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值