gui-right-menus.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view
  3. class="gui-right-menus"
  4. :style="styles">
  5. <view
  6. v-if="show"
  7. ref="guirightmenu"
  8. class="gui-rt-menus-animate"
  9. :class="[outting ? 'slideOutRight' : 'slideInRight']">
  10. <slot name="menus-more"></slot>
  11. </view>
  12. <view
  13. hover-class="gui-tap"
  14. @tap.stop="toggle">
  15. <slot name="menus-primary"></slot>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. // #ifdef APP-NVUE
  21. const animation = weex.requireModule('animation');
  22. import graceJS from '@/Grace6/js/grace.js';
  23. // #endif
  24. export default{
  25. name : "gui-right-menus",
  26. props : {
  27. styles:{type:String, default:'right:20rpx; bottom:200rpx; z-index:9; width:100rpx;'},
  28. },
  29. data() {
  30. return {
  31. show : false,
  32. outting : false
  33. }
  34. },
  35. methods:{
  36. toggle : function () {
  37. if(this.show){this.close();}else{this.open();}
  38. },
  39. open:function () {
  40. this.show = true;
  41. this.outting = false;
  42. // #ifdef APP-NVUE
  43. graceJS.getRefs('guirightmenu', this, 0, (ref)=>{
  44. animation.transition(ref, {
  45. styles : { transform:'translateX(0px)' },
  46. duration : 200, //ms
  47. timingFunction : 'ease',
  48. delay : 0 //ms
  49. });
  50. });
  51. // #endif
  52. },
  53. close : function () {
  54. this.outting = true;
  55. setTimeout(()=>{ this.show = false; }, 200);
  56. // #ifdef APP-NVUE
  57. graceJS.getRefs('guirightmenu', this, 0, (ref)=>{
  58. animation.transition(ref, {
  59. styles : { transform:'translateX(100px)' },
  60. duration : 200, //ms
  61. timingFunction : 'ease',
  62. delay : 0 //ms
  63. });
  64. });
  65. // #endif
  66. }
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. /* #ifndef APP-NVUE */
  72. @import "@/Grace6/css/animate.css";
  73. .gui-rt-menus-animate{animation-duration:200ms; animation-timing-function:linear;}
  74. /* #endif */
  75. /* #ifdef APP-NVUE */
  76. .gui-rt-menus-animate{transform:translateX(100px);}
  77. /* #endif */
  78. .gui-right-menus{position:fixed;}
  79. </style>