element-ui
Version:
A Component Library for Vue.js.
35 lines (34 loc) • 681 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DEMO</title>
</head>
<style>
.box {
border: 1px solid;
}
</style>
<body>
<app>
<p>点击黑框外面会隐藏 dropdown 元素</p>
<div v-clickoutside="show = false" class="box">
<button @click="show = true">click me</button>
<div v-show="show">dropdown</div>
</div>
</app>
</body>
<script src="./../node_modules/vue/dist/vue.min.js"></script>
<script src="./../build/index.js"></script>
<script>
Vue.use(VueClickOutside)
new Vue({
el: 'app',
data: function () {
return {
show: true
}
}
})
</script>
</html>