1.安装:npm install cube-ui -S
2.修改 .babelrc:(添加到plugins中去){ "plugins": [ ["transform-modules", { "cube-ui": { "transform": "cube-ui/lib/${member}", "kebabCase": true, "style": { "ignore": ["create-api", "better-scroll"] } } }] ] }3.在main.js
import Vue from 'vue'
import Cube from 'cube-ui' // 一般直接放在这个位置

Vue.use(Cube)

<template><div class="MemberInfor"><div class="content"><cube-form :model="model" @validate="validateHandler" @submit="submitHandler"><cube-form-group><cube-form-item :field="fields[0]"></cube-form-item><cube-form-item :field="fields[1]"></cube-form-item><cube-form-item :field="fields[2]"></cube-form-item><cube-form-item :field="fields[3]"><cube-button class="btn" @click="showDatePicker">{{model.dateValue || 'Please selectss'}}</cube-button><date-picker ref="datePicker" :min="[2008, 8, 8]" :max="[2020, 10, 20]" @select="dateSelectHandler"></date-picker></cube-form-item><cube-form-item :field="fields[4]"></cube-form-item><cube-form-item class="ss" :field="fields[5]"></cube-form-item></cube-form-group><cube-form-group><cube-button type="submit">Submit</cube-button></cube-form-group></cube-form></div></div></template>

<script>
import { DatePicker } from "cube-ui";
export default {data() {return {validity: {},valid: undefined,model: {inputValue: "kk",inputValues: "",radioValue: "man",dateValue: "",selectValue: "",checkboxGroupValue: ["Phone", "DM", "EDM", "SMS", "Share to LCLG"]},fields: [{type: "input",modelKey: "inputValue",label: "Surname",props: {placeholder: "请输入姓名"},rules: {required: true}},{type: "input",modelKey: "inputValues",label: "Phone",props: {placeholder: "请输入电话"},rules: {required: true}},{type: "radio-group",modelKey: "radioValue",label: "Gemder",props: {options: ["man", "woman"]},rules: {required: true}},{modelKey: "dateValue",label: "Date",rules: {required: true}},{type: "select",modelKey: "selectValue",label: "AgeGroup",props: {options: ["A1", "A2", "A3"]},rules: {required: true}},{type: "checkbox-group",modelKey: "checkboxGroupValue",label: "SharetoLCLG",props: {options: ["Phone", "DM", "EDM", "SMS", "Share to LCLG"]},rules: {required: true}}]};},methods: {submitHandler(e) {alert(this.model.inputValue +"*****" +this.model.inputValues +"***" +this.model.radioValue +"***" +this.model.dateValue +"***" +this.model.selectValue +"***" +this.model.checkboxGroupValue);},validateHandler(result) {this.validity = result.validity;this.valid = result.valid;},showDatePicker() {this.$refs.datePicker.show();},dateSelectHandler(date, selectedVal, selectedText) {this.model.dateValue = selectedVal;}},components: {DatePicker}
};
</script><style lang="stylus">
.MemberInfor {background-color: #FFA07A;width: 100%;height: 1600px;.content {display: inline-block;width: 90%;height: 1500px;background-color: #fff;margin-top: 15px;}.cube-form-item {font-size: 15px;}.btn {background-color: #ffffff;color: #C0C0C0;}.cube-form_standard .cube-validator {padding-right: 90px;}.ss {display: flex;flex-wrap: wrap;flex-direction: row;justify-content: center;}
}
</style>



转载于:https://www.cnblogs.com/huanhuan55/p/9766023.html

cube-ui的用法相关推荐

  1. cube ui tabbar 组件结构布局理解

    在之前项目中,由于设计图对tabbar设置固定的宽度,但是cube ui中都是全宽,在写项目的时候没有仔细看html布局和css样式,以为不能改变为固定宽度.在项目结束后,我研究了一下,终于解决. 选 ...

  2. Kendo UI Grid 用法详细整理

    目录 一. kendo UI grid结构 结构实例 二. kendo UI grid常用属性 1.new kendo.data.DataSource()中常见属性: 2.$("#grid& ...

  3. python webui测试ie浏览器环境配置_python+selenium做ui自动化测试用法必会

    一.前言 大家都知道,基于Web端的测试的基础框架是需要Selenium做主要支撑的,这里边给大家介绍下Web测试核心之基于 Python 的 Selenium Selenium 是用于测试 Web ...

  4. Hive sql分组函数grouping sets、cube、rollup用法简介

    文章目录 1.数据如下: 2.建表如下: 3.grouping sets 4.cube 5.rollup 1.数据如下: user_id,dep_id,group_id,salary 10001,a, ...

  5. Vue2 + cube UI 实现表单项目

    在工作中主要使用React,这次帮朋友做了一个简单的移动端项目使用到Vue框架所以记录总结一下. 项目的前端技术栈: 由于项目比较老使用的是Vue2, UI 框架使用滴滴开源的cube-ui.cube ...

  6. cube ui 的安装

    npm install cube-ui --save cube-ui 搭配 webpack 2+ 支持后编译和普通编译 2 种构建方式(默认使用后编译),使用前都需要修改应用的依赖和配置. 普通编译 ...

  7. 在cube ui中使用better-scroll 自定义下拉刷新和上拉加载内容

    在这次写项目中,偶然看到cube-ui组件库,看到这个ui组件库滚动盒子都是根据better-scroll封装的,在移动端上滑动效果体验比较不错,于是我决定使用cube-ui组件库,在使用过程中,在自 ...

  8. 在已有vue项目中半途引入cube ui组件库的使用遇到的坑(血泪)

    直接进入正题(我这儿是属于cube-ui普通编译) 1,在你的vue项目中找到package.json文件安装cube-ui 终端输入命令   npm install cube-ui --save 2 ...

  9. cube ui RecycleList 不自动追加数据

    Scroll 滚动列表,提供了优质的原生滚动体验,便捷的配置项和事件,是一个基于better-scroll进行封装的组件. 由于 better-scroll 的滚动原理为:在滚动方向上,第一个子元素的 ...

  10. vue rem插件与cube ui组件样式冲突

    我也在网上看了几篇文章后,才解决的.但是并不顺利,可能是我的操作有误,为了以后特地记录: postcss-px2rem不能忽略指定文件 需要安装postcss-px2rem-exclude(安装前需要 ...

最新文章

  1. postman对象参数null_postman的几种参数格式
  2. 彻底卸载 RAD Studio 2009/2010/XE+ 的步骤
  3. Java计算器接口策略_Java 基础 接口 ——运算
  4. 【Linux】一步一步学Linux——cut命令(44)
  5. c# in deep 之Lambda表达式
  6. php导出csv数据在浏览器中输出提供下载或保存到文件的示例
  7. .Net Core 3.0依赖注入替换 Autofac
  8. 1093 字符串A+B (20分)
  9. 图论 - 寻找fly真迹
  10. c++图书馆管理系统
  11. 藏在耳机里的小东西——蓝牙天线
  12. python异常类型大全
  13. 病毒软件诈骗帝国 恐惧心理刺激销售
  14. CorelDRAW 12快捷键
  15. matlab2016与VS2019混合编程
  16. 杨辉三角(案例演示)
  17. QNX铁路安全软件--QNX在铁路系统领域应用
  18. 阿里大于短信平台使用
  19. vue-router的两种模式及区别
  20. 做ARM的一些前后经历——转载的

热门文章

  1. 高精度电子罗盘的应用场景
  2. 【蓝桥杯06】:给定小明的城堡图,请问,水的高度依次为1,2,3,....,H时,有多少块积木要被水淹。
  3. 前端常用的CSS工具库
  4. Unity 绿幕视频抠图算法原理与实现 -- 效果极好
  5. centos7的freeswitch1.10.3自动安装脚本
  6. 相机分辨率, 图像分辨率
  7. Navicat如何把数据库导入(超详细图解)
  8. 中医文化的管理学启示
  9. 天线理论巴拉尼斯_天线理论与技术 - 心理学书籍 psychspace.com/钟顺时/
  10. Vue packages version mismatch: - vue@2.6.12 (C:\Users\Administrator\WebstormProjects\memorial\node_m