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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • c++ 分苹果_接苹果问题C语言

    c++ 分苹果_接苹果问题C语言#include<iostream>usingnamespacestd;intfun(intm,intn){if(m==0)return1;if(n==1)return1;if(m<n)returnfun(m,m);//最大的情况就是m个苹果放在m个盘子里面if(m>=n)retur…

    2022年10月12日
    2
  • 无线wifi-PJ-之在开启WPS下使用reaver

    无线wifi-PJ-之在开启WPS下使用reaverPJ简单解释:  PIN码分前4和后4,先破前4只有最多一万个组合,破后4中的前3只有一千个组合,一共就是一万一千个密码组合。10的4次方+10的3次方=11000个密码组合。  当reaver确定前4位PIN密码后,其任务进度数值将直接跳跃至90.9%以上,也就是说只剩余一千个密码组合了。总共一万一千个密码!—————————–

    2022年6月4日
    40
  • dvwa靶场教程_web漏洞靶场

    dvwa靶场教程_web漏洞靶场?DVWA靶场的概括:???DVWA是一个入门的Web安全学习靶场(包含:暴力激活成功教程,命令注入,文件包含,文件上传,不安全的验证码,SQL注入,跨站脚本,xss等.)提供给想学Web安全的人进行学习.

    2025年11月30日
    6
  • vue报错cannot read property_vue3 ref 数组

    vue报错cannot read property_vue3 ref 数组当函数执行到this.agents.splice()时,我设置了断点。发现传参index是0,但是页面上的列表项对应的第一行数据没有被删除,WTF!!!这是什么鬼!然后我打开VueDevtools,然后刷新了一下,发现那个数组的第一项还是存在的removeOneAgentByIndex:function(index){this.agents.splice(index,1)…

    2025年11月25日
    4
  • VisualSVN Server的配置和使用方法

    VisualSVN Server的配置和使用方法

    2021年9月19日
    81
  • 简单高效,分享几款我在使用的效率神器[通俗易懂]

    做一个积极的人编码、改bug、提升自己我有一个乐园,面向编程,春暖花开!今天周六了,分享几款我目前在用的小工具,希望对你有用。使用工具的好处等等,我就不过多介绍了,下面文章的内容是先简单介绍这几款工具,然后说明一下我是怎么应用的。简单的一个思维导图,看下本文全貌:文章目录神器介绍1、火柴-效率神器2、ALTRun – 快速启动3、Typora – Markdown 编辑器4、Snip…

    2022年2月28日
    110

发表回复

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

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