Toast.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <portal to="notification-outlet">
  3. <div class="toast-wrap" v-if="show">
  4. <div class="content">
  5. <div class="title">温馨提示</div>
  6. <div class="text" v-html="message||msg">
  7. <!-- {{message||msg}} -->
  8. </div>
  9. <div class="btn">
  10. <span @click="comfirn" class="comf">确定</span>
  11. <span @click="cancel" class="canc">取消</span>
  12. </div>
  13. </div>
  14. <div class="mask" @click="cancel"></div>
  15. </div>
  16. </portal>
  17. </template>
  18. <script type="text/javascript">
  19. import $ from 'jquery';
  20. export default {
  21. name:'Toast',
  22. data(){
  23. return {
  24. msg:"是否删除该信息?"
  25. }
  26. },
  27. props:['message','show','labShow'],
  28. methods:{
  29. comfirn(){
  30. $(".btscroll").css({'position':'absolute','top':'0'})
  31. $(".foot").css({'position':'absolute','bottom':'0'})
  32. this.$emit("comfirn")
  33. },
  34. cancel(){
  35. $(".btscroll").css({'position':'absolute','top':'0'})
  36. $(".foot").css({'position':'absolute','bottom':'0'})
  37. this.$emit("cancel")
  38. },
  39. },
  40. }
  41. </script>
  42. <style lang="less" scoped>
  43. @import '../less/base.less';
  44. .toast-wrap{
  45. .content{
  46. width: 6.3rem;
  47. background: #fff;
  48. z-index: 999;
  49. position: fixed;
  50. top:50%;
  51. left: 50%;
  52. transform: translate(-50%,-50%);
  53. padding: 0.6rem 0.6rem 1.5rem;
  54. box-sizing: border-box;
  55. border-radius: .2rem;
  56. z-index: 1000;
  57. overflow: hidden;
  58. .title {
  59. font-size: .32rem;
  60. text-align: center;
  61. font-weight: 800;
  62. }
  63. .text{
  64. color:#colors[quest];
  65. text-align: center;
  66. padding-top: .4rem;
  67. font-size: .3rem;
  68. }
  69. .btn{
  70. display: flex;
  71. justify-content: space-between;
  72. position: absolute;
  73. bottom: 0;
  74. left: 0;
  75. width: 6.3rem;
  76. height: .88rem;
  77. line-height: .88rem;
  78. border-top: 1px solid #colors[line];
  79. // font-weight: bold;
  80. span{
  81. display: inline-block;
  82. width: 50%;
  83. text-align: center;
  84. font-size: .32rem;
  85. }
  86. .comf{
  87. border-right: 1px solid #colors[line];
  88. box-sizing: border-box;
  89. color: #FF6167;
  90. }
  91. .canc{
  92. color: #333333;
  93. }
  94. }
  95. }
  96. .mask{
  97. .mask;
  98. z-index: 999;
  99. }
  100. }
  101. </style>