index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <uni-shadow-root class="vant-goods-action-index"><view :class="'custom-class '+(utils.bem('goods-action', { safe: safeAreaInsetBottom }))">
  3. <slot></slot>
  4. </view></uni-shadow-root>
  5. </template>
  6. <wxs src="../wxs/utils.wxs" module="utils"></wxs>
  7. <script>
  8. global['__wxRoute'] = 'vant/goods-action/index'
  9. import { VantComponent } from '../common/component';
  10. VantComponent({
  11. relation: {
  12. type: 'descendant',
  13. name: 'goods-action-button',
  14. current: 'goods-action',
  15. linked() {
  16. this.updateStyle();
  17. },
  18. unlinked() {
  19. this.updateStyle();
  20. },
  21. linkChanged() {
  22. this.updateStyle();
  23. },
  24. },
  25. props: {
  26. safeAreaInsetBottom: {
  27. type: Boolean,
  28. value: true,
  29. },
  30. },
  31. methods: {
  32. updateStyle() {
  33. wx.nextTick(() => {
  34. this.children.forEach((child) => {
  35. child.updateStyle();
  36. });
  37. });
  38. },
  39. },
  40. });
  41. export default global['__wxComponents']['vant/goods-action/index']
  42. </script>
  43. <style platform="mp-weixin">
  44. @import '../common/index.css';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
  45. </style>