custom-popup.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <!-- <van-popup closeable round :show="showPopup" @close="handleClosePopup" custom-style="width:90%;padding:20px;height:80%">
  3. <rich-text :nodes="nodeHtml"></rich-text>
  4. </van-popup> -->
  5. <uni-popup ref="popup" type="center" :mask-click="false">
  6. <view class="content">
  7. <view class="text">
  8. <rich-text :nodes="nodeHtml"></rich-text>
  9. </view>
  10. <button @tap="close">我已确认</button>
  11. </view>
  12. </uni-popup>
  13. </template>
  14. <script>
  15. import htmlParser from "@/utils/htmlParser";
  16. export default {
  17. data() {
  18. return {
  19. nodeHtml:'',
  20. showPopup:false,
  21. };
  22. },
  23. onLoad(options){
  24. console.log(options)
  25. },
  26. methods: {
  27. open({content}) {
  28. console.log('程序进来了吗',content)
  29. this.showPopup=true;
  30. this.$refs.popup.open();
  31. //接受富文本字符串
  32. if(content){
  33. // #ifdef MP-WEIXIN
  34. this.nodeHtml = content;
  35. // #endif
  36. // #ifdef MP-ALIPAY
  37. this.nodeHtml = htmlParser(content);
  38. // #endif
  39. }
  40. },
  41. handleClosePopup(){
  42. this.showPopup=false;
  43. },
  44. confirm() {},
  45. close() {
  46. this.$refs.popup.close();
  47. },
  48. handleCheckChange() {
  49. console.log(this.disable);
  50. },
  51. handleService(){
  52. },
  53. handlePrivate(){
  54. }
  55. },
  56. };
  57. </script>
  58. <style lang="scss" scoped>
  59. .van-popup {
  60. width: 80%;
  61. padding: 20rpx;
  62. }
  63. .content {
  64. width: 80vw;
  65. height: 70vh;
  66. padding: 15px;
  67. border-radius: 10px;
  68. background-color: #fff;
  69. .text {
  70. height: calc(70vh - 55px);
  71. overflow: auto;
  72. }
  73. button {
  74. width: 80vw;
  75. background-color: #1676fe;
  76. position: absolute;
  77. bottom: 10px;
  78. }
  79. }
  80. </style>