//main.js Vue.prototype.$bus = new Vue();
//GoodsList this.$bus.$emit("aaa")
//home.vue this.$bus.$on("aaa",()=>{ this.$refs.scroll.scroll.refresh() })
//GoodsListItem.vue <template> <img :src="showImage" alt="" @load="imgLoad" /> </template> imgLoad() { if (this.$route.path.indexOf("/home") !== 1) { this.$bus.$emit("homeImgLoad"); } else if (this.$route.path.indexOf("/detail") !== 1) { this.$bus.$emit("detailImgLoad"); } },
//home.vue mounted() { const refresh = debounce(this.$refs.scroll.refresh, 50); this.$bus.$on("homeImgLoad", () => { refresh(); }); },
//detail.vue mounted() { const refresh = debounce(this.$refs.scroll.refresh, 50); this.$bus.$on("detailImgLoad", () => refresh()); },
Vue3中CSS用法(scoped、选择器、module、v-bind)
2024-02-18