share-element-to.uvue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="main">
  3. <share-element class="share-element" share-key="left"
  4. :shuttle-on-pop="shuttleOnPush" :transition-on-gesture="transitionOnGesture" @tap="openPage()">
  5. <image src="https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/drop-card-1.jpg" mode="widthFix">
  6. </image>
  7. <view class="text-label">
  8. <text style="color: white;">每一口,都是幸福</text>
  9. </view>
  10. </share-element>
  11. </view>
  12. <share-element class="bottomWrap" share-key="bottom" @tap="openPage()"
  13. transitionOnGesture=true>
  14. <view class="bottom">
  15. <text style="color: white;">share-element(底部固定)</text>
  16. </view>
  17. </share-element>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. shuttleOnPush: "to",
  24. transitionOnGesture: false
  25. }
  26. },
  27. onLoad(event : OnLoadOptions) {
  28. this.shuttleOnPush = event["shuttleOnPush"] as string
  29. this.transitionOnGesture = event["transitionOnGesture"] === "true"
  30. console.log(`shuttleOnPush:${this.shuttleOnPush} transitionOnGesture:${this.transitionOnGesture}`)
  31. },
  32. methods: {
  33. openPage() {
  34. uni.navigateBack()
  35. }
  36. },
  37. }
  38. </script>
  39. <style>
  40. .bottomWrap {
  41. width: 100%;
  42. bottom: 0px;
  43. height: 80px;
  44. position: fixed;
  45. }
  46. .bottom {
  47. width: 100%;
  48. height: 100%;
  49. align-items: center;
  50. justify-content: center;
  51. background-color: #007aff;
  52. }
  53. .text-label {
  54. position: absolute;
  55. background-color: #007aff;
  56. opacity: 0.8;
  57. text-align: center;
  58. justify-content: center;
  59. align-items: center;
  60. bottom: 0px;
  61. left: 0px;
  62. right: 0px;
  63. height: 30px;
  64. }
  65. .main {
  66. padding: 5px;
  67. align-items: center;
  68. justify-content: center;
  69. }
  70. </style>