graceRightMessage.nvue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <view class="graceRightMessage" v-if="showIn"
  3. :style="{
  4. zIndex:zIndex, bottom:bottom, backgroundColor:background, width:status == 1 ? width : minWidth,
  5. height:height, borderRadius:height}">
  6. <view class="graceRightMessageIcon"><slot name="icon"></slot></view>
  7. <view class="graceRightMessageContent"><slot name="content"></slot></view>
  8. </view>
  9. </template>
  10. <script>
  11. export default{
  12. props:{
  13. zIndex : {type:Number, default:99},
  14. bottom : {type:String, default:'150rpx'},
  15. width : {type:String, default:'360rpx'},
  16. height : {type:String, default:'80rpx'},
  17. minWidth : {type:String, default:'180rpx'},
  18. background : {type:String, default:'#3688FF'}
  19. },
  20. data() {
  21. return {
  22. showIn : true,
  23. status : 1
  24. }
  25. },
  26. methods:{
  27. open:function () {
  28. this.status = 1;
  29. },
  30. hide:function(){
  31. this.showIn = false;
  32. },
  33. shrink:function(){
  34. this.status = 2;
  35. },
  36. show:function(){
  37. this.showIn = true;
  38. }
  39. }
  40. }
  41. </script>
  42. <style>
  43. .graceRightMessage{position:fixed; right:-100rpx; bottom:0; padding:10rpx; overflow:hidden; flex-direction:row; flex-wrap:nowrap; align-items:center; padding-right:100rpx;}
  44. .graceRightMessageIcon{text-align:center;}
  45. .graceRightMessageContent{width:1rpx; flex:1}
  46. </style>