Skip to content

Commit

Permalink
fix: 兼容 taro h5和小程序
Browse files Browse the repository at this point in the history
  • Loading branch information
Ymm0008 committed Nov 9, 2022
1 parent 1e9b8c4 commit ab55e04
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/packages/__VUE/lottoroll/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,32 @@ export default create({
const lottoRollWrap = ref();
const lottoWrap = ref();
const getLottoRollDom = () => {
const query = Taro.createSelectorQuery();
query.selectAll(".lotto-roll-wrap").boundingClientRect();
query.selectAll(".lotto-wrap").boundingClientRect();
query.exec((res) => {
lottoRollWrap.value = res[0];
lottoWrap.value = res[1];
});
};
onMounted(() => {
eventCenter.once((getCurrentInstanceTaro() as any).router.onReady, () => {
const query = Taro.createSelectorQuery();
query.selectAll(".lotto-roll-wrap").boundingClientRect();
query.selectAll(".lotto-wrap").boundingClientRect();
query.exec((res) => {
lottoRollWrap.value = res[0];
lottoWrap.value = res[1];
if (Taro.getEnv() == "WEAPP") {
eventCenter.once(
(getCurrentInstanceTaro() as any).router.onReady,
() => {
getLottoRollDom();
}
);
} else {
Taro.nextTick(() => {
getLottoRollDom();
});
});
}
});
const distanceObj = ref<Array<number>>([]);
const distanceObj: any = ref([]);
const animateRun = (timestamp: number) => {
// const timestamp = 0;
Expand Down

0 comments on commit ab55e04

Please sign in to comment.