11111
当前位置:   article > 正文

vue实现抽屉功能_avue 抽屉用法

avue 抽屉用法
  1. <template>
  2. <div class="drawer">
  3. <div @click="open()">11111</div>
  4. <div class="setbox" :class="{show: isshow}">
  5. <div class="header">
  6. <p class="fl">标题</p>
  7. <button class="off" @click="close">关闭</button>
  8. </div>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name:'demo',
  15. data() {
  16. return {
  17. isshow: false
  18. }
  19. },
  20. methods: {
  21. close() {
  22. this.isshow = false
  23. },
  24. open(){
  25. this.isshow = true
  26. }
  27. }
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. .drawer {
  32. height: 500px;
  33. width:100%;
  34. display:flex;
  35. display:-webkit-flex;
  36. flex-direction:column;
  37. .setbox{
  38. position:fixed;
  39. z-index:1000;
  40. top:0px;
  41. bottom:0px;
  42. width:350px;
  43. height:100%;
  44. background:gray;
  45. border-left: 1px solid #CFD8DC!important;
  46. box-shadow:0px 3px 12px rgba(0,0,0,0.12);
  47. -webkit-transition: all 0.3s ease;
  48. transition: all 0.3s ease;
  49. right:-460px;
  50. padding:0px 0px 0px 20px;
  51. }
  52. .show {
  53. right: 0;
  54. }
  55. }
  56. </style>

点击div显示抽屉,点击抽屉的按钮消失

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签