Giter VIP home page Giter VIP logo

qswitch's Introduction

Qswitch

An awesome switch component for Vue.(一个帅气的Vue开关组件。)

Build Setup(构建安装)

# Before doing so, make sure Vue(>2.2) is installed correctly.(在此之前,请确保Vue(>2.2)已正确安装。)
# install Qswitch for your project.(为你的项目安装Qswitch。)
npm install qswitch --save

Import(导入组件)

import Qswitch from 'path/to/Qswitch'
Vue.use(Qwsitch)

Usage

In order to achieve twoway binding, must set the v-model attribute for Qswitch. (为了实现双向绑定,必须设置v-model属性。)

<div>
	<h2>Qswitch default v-model: {{ ref_to_checked }}</h2>
	<qswitch v-model="ref_to_checked" :value="val"></qswitch>
</div>
  import Qswitch from './components/Qswitch.vue'

  export default {
    name: 'app',
    data() {
      return {
        msg: 'An awesome switch component for Vue.',
        val: 'I am value',
        ref_to_checked: false
      }
    },
    components: {
      'qswitch': Qswitch
    }
  }

Alt text

Demo.(请看实际例子。)

font awesome is required in order to dispaly icon for Qswitch.(需要 font awesome才能显示Qswitch的图标。)

Properties(属性)

Name Type Default Description
name String The name attribute of the <input type="checkbox" /> element in the Qswitch componnent.(Qswitch组件中<input type ="checkbox"/>元素的name属性的值。)
value String false The value attribute of the <input type="checkbox" /> element in the Qswitch componnent.(Qswitch组件中<input type ="checkbox"/>元素的value属性的值。)
checked Boolean false The checked attribute of the <input type="checkbox" /> element in the Qswitch componnent.(Qswitch组件中<input type ="checkbox"/>元素的checked属性的值。)
type String default The type of Qswitch componnent, allow values: defaulttexticon and 3d.(Qswitch组件的类型,允许值为:defaulttexticon3d。)
size String default The size of Qswitch componnent, allow values: defaultminismall and big.(Qswitch组件的大小,允许值为:defaultminismallbig。)
icon String The icon of Qswitch componnent, allow values: happylockcheckcheck2check3 and check4.(Qswitch组件的图标,允许值为:happylockcheckcheck2check3check4。)
color String blue The color of Qswitch componnent, allow values: blackaquabluefuchsiagreen , lime, maroonnavyoliveorangepurple , redsilvergrayteal and yellow.(Qswitch组件的颜色,允许值为:blackaquabluefuchsiagreenlimemaroonnavyoliveorangepurpleredsilvergraytealyellow。)
pill Boolean false The Qswitch componnent dispaly as a pill shape.(Qswitch组件已胶囊形状显示。)
outline Boolean false The Qswitch componnent dispaly as an outline shape.(Qswitch组件已轮廓形状显示。)
alt Boolean false The Qswitch componnent dispaly as the default but outline shape.(Qswitch组件已默认加轮廓形状显示。)
text_on String The text of the Qswitch componnent when it is on. Only valid when type is text.(Qswitch组件处于开启状态时显示的文字。只有在typetext`的时候有效。)
text_off String The text of the Qswitch componnent when it is off. Only valid when type is text.(Qswitch组件处于关闭状态时显示的文字。只有在typetext`的时候有效。)

Donate(赞助)

Alt text

qswitch's People

Contributors

lichuhui avatar

Watchers

James Cloos avatar

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.