index.vue 526 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <view>
  3. <cart-container ref="cartContainer"></cart-container>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. }
  11. },
  12. onShow() {
  13. // 每次显示页面时,调用子组件的刷新方法
  14. this.$nextTick(() => {
  15. if (this.$refs.cartContainer) {
  16. this.$refs.cartContainer.loadData();
  17. }
  18. });
  19. },
  20. methods: {
  21. }
  22. }
  23. </script>
  24. <style>
  25. /* Empty style as content is in the component */
  26. </style>