npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xunlei/vue-modal

v1.0.0

Published

Vue 2.x 模态框组件

Downloads

10

Readme

@xunlei/vue-modal

Vue 2.x 模态框组件

在线demo

https://xunleif2e.github.io/vue-modal/demo/dist/index.html

Installation

npm i @xunlei/vue-modal -S

使用

注册插件

1. 注册组件 / Registration

方式1 利用插件方式全局注册 / Use plugin to register a global component

import Vue from 'vue'
import VueModal from '@xunlei/vue-modal'

// import css
import '@xunlei/vue-modal/src/vue-modal.css'

Vue.use(VueModal)

方式2 局部注册 / Local Registration

import { component as VueModal } from '@xunlei/vue-modal'
// import css
import '@xunlei/vue-modal/src/vue-modal.css'

export default {
  // ...
  components: {
    'vue-modal': VueModal
  }
}

方式3 独立版本引入,自动全局注册 / Direct <script> Include

前提是 vue 也是独立版本通过script标签引入 / The premise is that Vue is also use direct <script> include.

<link type='text/css' rel="stylesheet" href="https://unpkg.com/@xunlei/vue-modal@latest/src/vue-modal.css">
<script src="https://unpkg.com/@xunlei/vue-modal@latest/dist/vue-modal.js"></script>

用法

<button
  @click="showModal = true"
>
  Show Modal
</button>

<vue-modal
  v-model="showModal"
  :backdrop="false"
>
  <!-- content here --> 
</vue-modal>

API

Props

| 参数 | 说明 | 类型 | 可选值 | 默认值 | |----------|------------------------------------------------------------------|---------|--------|--------| | backdrop | 是否需要背景蒙层,有背景蒙层时为模态,不能操作弹出层后方的UI界面 | Boolean | Y | true | | timeout | 自动关闭弹出层的时间,单位为ms | Number | Y | - |

Events

| 事件名 | 说明 | 事件参数 | |-------------|----------------------------|----------| | show | 模态框显示事件 | - | | hide | 模态框隐藏事件 | - | | after-leave | 模态框离开动画执行完成事件 | - |

Style class

如果要定制一些外观和动画效果,可以覆盖以下的class

| class | 说明 | |-------------------------------|----------------------------| | .modal-mask | 模态框背景蒙层 | | .modal-content | 模态框内容盒子 | | .modal-mask.modal-transparent | 失去模态的背景蒙层 | | .modal-enter-active | 模态框进入活动状态 | | .modal-leave-active | 模态框离开活动状态 | | .modal-mask-enter-active | 模态框背景蒙层进入活动状态 | | .modal-mask-leave-active | 模态框背景蒙层离开活动状态 | | .modal-mask-enter | 模态框背景蒙层开始进入 |

开发命令

# install deps
npm install

# serve demo at localhost:8080
npm run dev

# build library and demo
npm run build

# build library
npm run build:library

# build demo
npm run build:demo

# commit use commitizen
npm run commit

# pre publish
npm run prepublish

# generate changelog
npm run changelog

License

MIT

Copyright (c) 2017 赵兵