有关微信小程序中弹框与模态框的实现方式探讨

why 166 2024-08-15

这篇文章主要介绍了微信小程序 弹框和模态框实现代码的相关资料,需要的朋友可以参考下

微信小程序 弹框和模态框实现代码

实现效果图:

image.png

实现代码:             


1

2

3

4

5

<view class="wxapp-modal" style="{{modal_style}}">

     <view class="content">

     </view>

    <view class="mask" bindtap="closeModal"></view>

   </view>



1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

/*模态框*/

.wxapp-modal{

 width: 100%;

 height: 100%;

 position: fixed;

 top: 0px;

 left: 0px;

 z-index:999;

}

.wxapp-modal .content{

 width: 100%;

 bottom: 10px;

 text-align: center;

 position: absolute;

}

.wxapp-modal .content .header{

 margin: auto;

 width: 93%;

 height: 60px;

 line-height: 60px;

 text-align: center;

 background-color: #FFFFFF;

 position: relative;

 z-index:9999;

 border-top-left-radius: 8px;

 border-top-right-radius: 8px;

 border-bottom: 1px #eee solid;

}

.wxapp-modal .content .body{

 margin: auto;

 width: 93%;

 background-color: #FFFFFF;

 position: relative;

 z-index:9999;

 border-bottom-left-radius: 8px;

 border-bottom-right-radius: 8px;

 overflow: hidden;

}

.wxapp-modal .content .footer{

 margin: auto;

 width: 93%;

 height: 60px;

 line-height: 60px;

 background-color: #FFFFFF;

 position: relative;

 z-index: 9999;

 border-radius: 8px;

 margin-top: 10px;

 text-align: center;

}

.wxapp-modal .content .footer button{

 display: inline-block;

 width: 49%;

 height: 60px;

 line-height: 60px;

 background-color: #FFFFFF;

 margin-left: 0px;

}

.wxapp-modal .content .footer button:active{

 background-color: #eee;

}

.wxapp-modal .content .footer button::after{

 content:none;

}

.wxapp-modal .content .footer .cancel{

 color: #fa5b43;

 border-right: 1px #eee solid;

 border-top-right-radius: 0px;

 border-bottom-right-radius: 0px;

 border-top-left-radius: 8px;

 border-bottom-left-radius: 8px;

}

.wxapp-modal .content .footer .confirm{

 color: #1ed3fa;

 border-top-left-radius: 0px;

 border-bottom-left-radius: 0px;

 border-top-right-radius: 8px;

 border-bottom-right-radius: 8px;

}

.wxapp-modal .mask{

 width: 100%;

 height: 100%;

 position: fixed;

 top: 0px;

 background-color:rgba(0,0,0,0.5);

}


以上就是本文的全部内容,希望对大家的学习有所帮助。


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:解决微信小程序请求服务器手机预览无法获取数据的有效方案
下一篇:微信小程序中图片宽度自适应的有效实现途径
相关文章

 发表评论

暂时没有评论,来抢沙发吧~