Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro3 在字节小程序中,onLoad 和 onShow 的触发时机不正确 #8326

Closed
yeyan1996 opened this issue Dec 20, 2020 · 2 comments
Closed
Labels
F-vue3 Framework - Vue 3 T-tt Target - 编译到字节跳动小程序 V-3 Version - 3.x
Milestone

Comments

@yeyan1996
Copy link

yeyan1996 commented Dec 20, 2020

相关平台

字节跳动小程序

小程序基础库: 3.0.0-rc4
使用框架: Vue 3

复现步骤

<template>
  <view>123</view>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  onLoad() {
    console.log('onLoad')
  },
  onShow() {
    console.log('onShow')
  },
  onReady() {
    console.log('onReady')
  },
})
</script>

期望结果

�onLoad -> onShow -> onReady

实际结果

�onShow -> onLoad -> onReady

环境信息

👽 Taro v3.0.21


  Taro CLI 3.0.21 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
      Yarn: 1.22.4 - ~/.nvm/versions/node/v12.13.1/bin/yarn
      npm: 6.14.7 - ~/.nvm/versions/node/v12.13.1/bin/npm
    npmPackages:
      @tarojs/components: 3.0.19 => 3.0.19 
      @tarojs/mini-runner: latest => 3.0.18 
      @tarojs/runtime: 3.0.19 => 3.0.19 
      @tarojs/taro: 3.0.19 => 3.0.19 
      @tarojs/webpack-runner: 3.0.19 => 3.0.19 
      babel-preset-taro: 3.0.19 => 3.0.19 
      eslint-config-taro: 3.0.19 => 3.0.19 

@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-tt Target - 编译到字节跳动小程序 V-3 Version - 3.x labels Dec 20, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Dec 20, 2020

这三个生命周期只是直接触发的,触发时机和小程序平台相关,和 taro 无关

@Chen-jj Chen-jj closed this as completed Dec 20, 2020
@yeyan1996
Copy link
Author

yeyan1996 commented Dec 20, 2020

将代码降级为 Vue2,分别使用 uni-app/taro 编译

在 uni-app 生命周期为
onShow -> onLoad -> onReady

在 taro 中,生命周期为
onLoad -> onShow -> onReady

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-tt Target - 编译到字节跳动小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants