Code Monkey home page Code Monkey logo

Button使用


1.基本用法

Button 组件默认提供7种主题,由type属性来定义,默认为default。

<zt-button>默认按钮</zt-button>
<zt-button type="primary">主要按钮</zt-button>
<zt-button type="text">文字按钮</zt-button>

2.禁用状态

你可以使用disabled属性来定义按钮是否可用,它接受一个Boolean值。

<zt-button :plain="true" :disabled="true">主要按钮</zt-button>
<zt-button type="primary" :disabled="true">主要按钮</zt-button>
<zt-button type="text" :disabled="true">文字按钮</zt-button>

3.自动聚焦

你可以使用autofocus属性来定义按钮是否自动聚焦(自动高亮),它接受一个Boolean值。

<zt-button :autofocus="true">默认按钮</zt-button>

4.默认显示颜色

<zt-button type="success">成功按钮</zt-button>
<zt-button type="warning">警告按钮</zt-button>
<zt-button type="danger">危险按钮</zt-button>
<zt-button type="info">信息按钮</zt-button>

5.hover(鼠标触发)显示的颜色

<zt-button :plain="true" type="success">成功按钮</zt-button>
<zt-button :plain="true" type="warning">警告按钮</zt-button>
<zt-button :plain="true" type="danger">危险按钮</zt-button>
<zt-button :plain="true" type="info">信息按钮</zt-button>

6.图标按钮

我们这个图表按钮中的字体图标采用的是fontawesome的字体图表,icon值为fontawesome官方提供的class类名一致即可

<zt-button type="success" icon="fa fa-refresh fa-spin fa-fw"></zt-button>
<zt-button type="success" icon="fa fa-reply">回撤</zt-button>
<zt-button type="success" icon="fa fa-search">搜索</zt-button>
<zt-button type="success" icon="fa fa-pencil-square-o">编辑</zt-button>

7.不同尺寸

额外的尺寸:large、small、mini,通过设置size属性来配置它们。

<zt-button type="primary" size="large">大型按钮</zt-button>
<zt-button type="primary">正常按钮</zt-button>
<zt-button type="primary" size="small">小型按钮</zt-button>
<zt-button type="primary" size="mini">超小按钮</zt-button>

8.属性(Attributes)

参数 说明 类型 可选值 默认值
size 尺寸 string large,small,mini
type 类型 string primary,success,warning,danger,info,text
plain 是否朴素按钮 Boolean false
disabled 是否禁用状态 Boolean false
icon 图标 string
autofocus 是否默认聚焦 Boolean false
native-type 原生 type 属性 button,submit,reset button

运行此button

终端至于根目录

npm install    // 下载依赖包
npm run dev    // 使用8092端口打开

zhangxi's Projects

birthday icon birthday

A Happy Birthday animation design in CSS3, HTML5

component icon component

主要呈现如何使用vue的脚手架vue-cli以及组件component

d3 icon d3

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

inotify icon inotify

:loudspeaker: JS achieve the browser title flashing, scrolling, voice prompts, Chrome/Safari/FireFox/IE notice. has no dependencies. It not interfere with any JavaScript libraries or frameworks. has a reasonable footprint 5.05kb (gzipped: 1.75kb)

ts-keycode-enum icon ts-keycode-enum

A TypeScript enum definition that maps human-friendly key names to JavaScript key codes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.