vue-draggable-button
v0.1.6
Published
可拖拽的vue按钮
Downloads
920
Readme
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="./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="./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>