cube-ui的用法

cube-ui的用法1.安装:npminstallcube-ui-S2.修改.babelrc:(添加到plugins中去){"plugins":[["transform-m

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺


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://javaforall.net/168149.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Fiddler HPPTS 配置教程「建议收藏」

    Fiddler HPPTS 配置教程「建议收藏」 思路:先清除,之前的网站证书再安装fiddler的证书。具体看下面:https://www.cnblogs.com/xiao-qing/p/7771289.html转载于:https://www.cnblogs.com/limi2019/articles/11233846.html…

    2022年10月2日
    0
  • 002.AnyCast技术浅析

    002.AnyCast技术浅析  一常见通信方式    1.1UniCastAnyCast    UniCast,即单播,指网络中一个节点与另一个节点之间需要建立一个单独的数据通道,从一个节点发出的信息只被一个节点收到,这种传送方式称为单播。即网络中从源向目的地转发单播流量的过程,IP地址与节点(主机)一一对应,单播流量地址唯一。每个节点必须分别对需要访问的节点发送单独的查询,而被访问节点必须向每个访问节点发送所申请的数…

    2022年5月23日
    36
  • 获取Google音乐的具体信息(方便对Google音乐批量下载)

    获取Google音乐的具体信息(方便对Google音乐批量下载)

    2021年12月14日
    58
  • Qt之读写文件

    Qt之读写文件1.思路读写文件的基本操作:读文件写文件打开文件打开文件读取文件写入文件关闭文件关闭文件2.QFile实现读写文件QFile类提供读写文件的接口。它的构造函数如下:QFile(constQString&name)QFile(QObject*parent)QFile(constQString&name,QObject*parent)通过它的构造函数我

    2022年6月2日
    31
  • python常用面试题_Python+Selenium 常见面试题整理[通俗易懂]

    python常用面试题_Python+Selenium 常见面试题整理[通俗易懂]整理加复习1、记录一下刚刚看到的博客https://www..com/lesleysbw/p/5916022.html中的一小段非常认同看到一位大神的面试准备,我不想写了TT。等我好好看完,再决定怎么继续写下去吧,照搬毫无意义。大神博客地址:https://www..com/lesleysbw/category/946223.htmlQunar机票搜索场景访问Qunar机票首页http://fli…

    2022年6月20日
    27
  • 无人驾驶安全报告分析

    摘要随着经济的快速发展,各国汽车保有量急剧增加,促使城市路况更加严峻繁杂,城市交通正面临着前所未有的巨大压力。加之疲劳驾驶、酒后驾驶等人为因素,使世界各国的交通事故率逐年上升,甚至多于世界大战死亡人数。随着汽车技术、信息通信技术与智能控制技术的高效融合,集自动控制、人工智能、体系结构视觉设计等众多技术于一体的无人驾驶汽车应运而生。通过在车辆内安装智能操纵控制系统与感应设备来获取信息用以控制车…

    2022年4月7日
    38

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号