uni-cart-fix.vue 719 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <view class="cart-fix" @click="toCart">
  3. <u-image width="50rpx" height="50rpx" src="/static/cart.png"></u-image>
  4. <u-badge absolute :offset="[15,10]" type="error" :count="count"></u-badge>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. count: {
  11. type: Number,
  12. default: 0
  13. },
  14. },
  15. data() {
  16. return {
  17. }
  18. },
  19. methods: {
  20. toCart() {
  21. uni.navigateTo({
  22. url:"/pages/cart/cart"
  23. })
  24. }
  25. },
  26. }
  27. </script>
  28. <style lang="scss">
  29. .cart-fix{
  30. position: fixed;
  31. z-index: 100000;
  32. background: rgba($color: #00aa00, $alpha: 0.9);
  33. padding: 20upx;
  34. border-radius: 100%;
  35. bottom: 15%;
  36. right: 5%;
  37. box-shadow: 0upx 3upx 8upx #999;
  38. }
  39. </style>