支付宝小程序组件 文本视图·cover-view

2020-09-18 10:47 更新

版本要求:基础库 1.10.0 或更高版本;若版本较低,建议做 兼容处理

覆盖在原生组件之上的文本视图。可覆盖的原生组件包括 mapcanvas

注意:实际效果请以真机为准。

扫码体验

示例代码

  1. <!-- API-DEMO page/component/cover-view.axml -->
  2. <view class="page">
  3. <view class="page-description">cover-view</view>
  4. <view class="page-section">
  5. <view class="page-section-demo" style="position: relative;">
  6. <map
  7. longitude="{{longitude}}"
  8. latitude="{{latitude}}"
  9. scale="{{scale}}"
  10. style="width: 100%; height: 200px;"
  11. include-points="{{includePoints}}"
  12. />
  13. <cover-view class="cover-view">
  14. <cover-view class="cover-view-item cover-view-item-1"></cover-view>
  15. <cover-view class="cover-view-item cover-view-item-2"></cover-view>
  16. <cover-view class="cover-view-item cover-view-item-3"></cover-view>
  17. </cover-view>
  18. <cover-image style="" src="/image/ant.png" />
  19. </view>
  20. </view>
  21. </view>
  22. // API-DEMO page/component/cover-view.js
  23. Page({
  24. data: {
  25. scale: 14,
  26. longitude: 120.10675,
  27. latitude: 30.266786,
  28. includePoints: [{
  29. latitude: 30.266786,
  30. longitude: 120.10675,
  31. }],
  32. }
  33. });
  34. /* API-DEMO page/component/cover-view.acss */
  35. cover-image {
  36. position: absolute;
  37. left: 20px;
  38. top: 100px;
  39. height: 50px;
  40. width: 50px;
  41. }
  42. .cover-view {
  43. position: absolute;
  44. top: calc(50% - 75rpx);
  45. left: calc(50% - 150rpx);
  46. display:flex;
  47. flex-direction:row;
  48. background-color: rgba(0, 0, 0, 0);
  49. }
  50. .cover-view-item{
  51. width: 100rpx;
  52. height: 150rpx;
  53. font-size: 26rpx;
  54. }
  55. .cover-view-item-1 {
  56. background-color: rgba(26, 173, 25, 0.7);
  57. }
  58. .cover-view-item-2 {
  59. background-color: rgba(39, 130, 215, 0.7);
  60. }
  61. .cover-view-item-3 {
  62. background-color: rgba(255, 255, 255, 0.7);
  63. }

属性

属性名 类型 默认值 描述 最低版本
onTap EventHandle - 点击事件回调。 1.9.0

常见问题

cover-view 默认背景白色如何取消?

不支持更改背景色,建议更改字体颜色。

cover-view是否支持圆角和阴影?

小程序 acss 支持圆角和阴影,示例代码: 圆角:border-radius: 15%; 阴影:box-shadow: 10px 10px 5px #888888;

以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号