uni-cart-fix.vue 694 B

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <view class="cart-fix" @click="toCart">
  3. <u-image width="70rpx" height="70rpx" 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. computed: {
  10. count() {
  11. return this.$store.state.vuex_cartNums
  12. }
  13. },
  14. methods: {
  15. toCart() {
  16. uni.navigateTo({
  17. url:"/pages/cart/cart"
  18. })
  19. }
  20. },
  21. }
  22. </script>
  23. <style lang="scss">
  24. .cart-fix{
  25. position: fixed;
  26. z-index: 100000;
  27. background: rgba($color: #ffffff, $alpha: 0.7);
  28. padding: 10upx;
  29. border-radius: 100%;
  30. bottom: 40%;
  31. right: 2%;
  32. box-shadow: 3upx 3upx 8upx #ccc;
  33. }
  34. </style>