docs_vue2/one/docs/demo/directives/drag/containment.vue

39 lines
492 B
Vue
Raw Normal View History

2020-08-13 11:47:56 +08:00
<template>
<article>
<div
ref="container"
class="container"
>
<div
ref="target"
v-drag:target.translate="{containment: 'container'}"
class="target"
/>
</div>
</article>
</template>
<script>
import { drag } from 'veui'
2020-08-13 11:47:56 +08:00
export default {
directives: {
drag
}
}
</script>
2021-09-15 20:03:51 +08:00
<style lang="less" scoped>
2020-08-13 11:47:56 +08:00
.target {
2021-09-15 20:03:51 +08:00
width: 80px;
height: 80px;
background: #e7e7e7;
2020-08-13 11:47:56 +08:00
}
.container {
2021-09-15 20:03:51 +08:00
width: 100%;
height: 300px;
background: #f7f7f7;
2020-08-13 11:47:56 +08:00
}
</style>