Giter Club home page Giter Club logo

mobile-button's Introduction

Target

规范网页中使用按钮的代码

Usage

Basic

import MobileButton from '@forzoom/mobile-button';
Vue.component('MobileButton', MobileButton);
<MobileButton tag="router-link"
	name="primary"
	to="/path/to/target"
	:is-block="true"
	:is-disabled="true">
	click me
</MobileButton>

生成的html

<router-link class="btn btn-mobile btn-primary btn-block disabled" to="/path/to/target">
	click me
</router-link>

使用类型为Object的to

<MobileButton tag="router-link"
	name="primary"
	tag="router-link"
	:to="{ name: 'path_to_target' }"
	:is-block="true"
	:is-disabled="true">
	click me
</MobileButton>

Props

名称 类型 默认 描述
id String null 添加到外层元素的id
class-list Object/Array null 添加到外层元素的class
tag String a 生成的元素,例如可以是div/a/router-link等
name String null 添加btn-${name}样式类,如果是空则不添加
to Object/String null 点击导航地址,类似于router-link中的to。只有当tag的值为router-link时,to的类型允许是Object
is-block Boolean false 是否添加btn-block样式类
is-disabled Boolean false 是否添加disabled样式类
is-selected Boolean false 是否添加selected样式类

备注: 由于组件使用render函数渲染,暂时需要使用id和classList来传入id和class

Events

名称 参数 描述
click (event) 非disabled情况下点击将触发该事件
click-when-disabled (event) disabled情况下点击将触发该事件

Tip

  1. 为了iOS能够正常触发active效果,组件本身监听了touchstart事件
  2. 由于Vue的逻辑,实际上使用class就可以起到classList的效果

mobile-button's People

Contributors

forzoom avatar

Watchers

 avatar  avatar

Forkers

keleen

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.