vue-draggable-button

可拖拽的vue按钮
4,465 13
Install
npm install vue-draggable-button
Latest Version:0.1.6
Vue:2
Last Updated:Jun 17, 2024
Links: GitHub  ·  npm
Maintainer: thinkingthigh

vue-draggable-button

A draggable button for Vue.

Usage

Install

npm i vue-draggable-button

Example

You can use it like this

main.js

import Vue from 'vue'
import App from './App.vue'
import draggableButton from 'vue-draggable-button';
Vue.config.productionTip = false

Vue.use(draggableButton);

new Vue({
  render: h => h(App),
}).$mount('#app')

App.vue

<template>
  <div id="app">
    <img alt="Vue logo" src="https://raw.githubusercontent.com/ThinkingThigh/vue-draggable-button/HEAD/assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
    <draggable-button :isClick.sync="btnIsClick">
      <img alt="Vue logo" :draggable="false" @click="clickHandler" src="https://raw.githubusercontent.com/ThinkingThigh/vue-draggable-button/HEAD/assets/logo.png" />
      <div @click.stop="clickHandler">drag it ↑</div>
    </draggable-button>
  </div>
</template>
<script>
import HelloWorld from "./components/HelloWorld.vue";
export default {
  name: "App",
  data() {
    return {
      btnIsClick: false,
    };
  },
  components: {
    HelloWorld,
  },
  methods: {
    clickHandler() {
      if (this.btnIsClick) {
        alert("Hi!");
      }
    },
  },
};
</script>

CHANGELOG

CHANGELOG.md

Version History

Version Released Vue License
0.1.6 ^2.6.11
0.1.5 ^2.6.11
0.1.4 ^2.6.11
0.1.3 ^2.6.11
0.1.2 ^2.6.11