Skip to content

d1y/vue-spark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cfb60f5 · May 5, 2020

History

4 Commits
May 5, 2020
May 5, 2020
May 5, 2020
May 5, 2020
May 3, 2020

Repository files navigation

vue-spark

简单的点击效果

update

npm install --save vue-spark

main.js 中引入,

import Click from 'vue-spark'
import Vue from 'vue'

Vue.use(Click())

你也可以在Click()中传入参数

import Click from 'vue-spark'
const options = {
  opacity: .5, // 透明度. 最小0.1, 最大1
  style: {
    backgroundColor: 'green'
  } // 自定义的样式
}
Vue.use(Click(options))

如果你需要修改样式的话, 需要在 vm.$nextTick 回调中使用setStyle方法

import { setStyle } from 'vue-spark'

{
  created() {
    this.$nextTick(()=> {
      setStyle({
        backgroundColor: 'blue',
        width: `120px`,
        height: `120px`
      })
    })
  }
}

在你需要的元素添加自定义指令即可

<template>
  <div id="app" v-click>
    <router-view/>
  </div>
</template>

About

a vuejs click effect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published