gui-right-menus.vue 1.8 KB

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