Coder Social home page Coder Social logo

takitaa / vue-slideout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hyjiacan/vue-slideout

0.0 2.0 0.0 1.89 MB

A Slide-Out component for Vue.js 2.0

Home Page: https://hyjiacan.github.io/vue-slideout/

License: MIT License

JavaScript 38.25% HTML 0.96% Vue 50.76% Less 10.02%

vue-slideout's Introduction

Slideout

NPM Travis (.org) npm (scoped) npm bundle size (scoped) npm Coverage Status

A Slide-Out component for Vue3

Dependencies

  • Vue.js 3.x
  • Less

Install

NodeJS ENV (commonjs)

npm i @hyjiacan/vue-slideout@3

or

yarn add @hyjiacan/vue-slideout@3

If you need compatible with Vue.js 2.x, use version @hyjiacan/vue-slideout@2.

You can get the latest code:

git clone https://github.com/hyjiacan/vue-slideout.git

or just download archive

Browser ENV (umd)

Like node-env, a global Slideout will be attached onto window.

The newest version

<script src="https://cdn.jsdelivr.net/npm/@hyjiacan/vue-slideout/lib/slideout.umd.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hyjiacan/vue-slideout/lib/slideout.css"/>

Specified version

<script src="https://cdn.jsdelivr.net/npm/@hyjiacan/vue-slideout@<VERSION>/lib/slideout.umd.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hyjiacan/vue-slideout@<VERSION>/lib/slideout.css"/>

unpkg is also available: instead cdn.jsdelivr.net with unpkg.com.

Also, you can use the uncompressed dist by instead slideout.umd.min.js with slideout.umd.js

Usage

Global (recommended)

main.js

import Vue from 'vue'
import Slideout from '@hyjiacan/vue-slideout'
import '@hyjiacan/vue-slideout/lib/slideout.css'

// import Slideout component, and set the defaults props
Vue.use(Slideout, {
  // set default props here
})

In Component

Foobar.vue

<template>
  <slideout @closing="onClosing" v-model="visible" title="The title">
    <div>content</div>
  </slideout>
</template>
<script>
import Slideout from '@hyjiacan/vue-slideout'
import '@hyjiacan/vue-slideout/lib/slideout.css'

export default {
  name: 'Foobar',
  components: { Slideout },
  data () {
    return {
      visible: false
    }
  },
  methods: {
    onClosing (e) {
      // prevent close and wait
      e.pause = true
      // close after 3 seconds
      setTimeout(() => {
        // assign true to close, do nothing or assign false to cancel close.
        e.resume = true
      }, 3000)
    }
  }
}
</script>

Try it on the fly CodePen

Development

yarn
# start dev server
yarn serve
# Build library
yarn release

vue-slideout's People

Contributors

hyjiacan avatar breadadams avatar

Watchers

 avatar  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.