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

Taro 页面事件处理函数 调用 setup 里面方法问题 #7361

Closed
lixiang opened this issue Aug 18, 2020 · 1 comment
Closed

Taro 页面事件处理函数 调用 setup 里面方法问题 #7361

lixiang opened this issue Aug 18, 2020 · 1 comment
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@lixiang
Copy link

lixiang commented Aug 18, 2020

相关平台

微信小程序

小程序基础库: 2.12.1
使用框架: Vue 2

复现步骤

vue2使用是 composition api,入口是setup方法,onPullDownRefresh是taro提供页面事件处理函数,怎么调用setup里面定义的方法?

onPullDownRefresh() {
   Taro.showNavigationBarLoading()
   getTeacherList()
},
setup() {
  const getTeacherList = () => {
  //xxxxxxx
 }
}

期望结果

期望能够调用,获取正确做法是?

实际结果

调用提示未定义函数

环境信息

👽 Taro v3.0.6


  Taro CLI 3.0.6 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.15.3 - /usr/local/bin/node
      Yarn: 1.21.1 - ~/.yarn/bin/yarn
      npm: 6.13.4 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.6 => 3.0.6
      @tarojs/mini-runner: 3.0.6 => 3.0.6
      @tarojs/runtime: 3.0.6 => 3.0.6
      @tarojs/taro: 3.0.6 => 3.0.6
      @tarojs/webpack-runner: 3.0.6 => 3.0.6
      babel-preset-taro: 3.0.6 => 3.0.6
      eslint-config-taro: 3.0.6 => 3.0.6

补充信息

应该按什么样的调用方式去处理?

@taro-bot2 taro-bot2 bot added F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Aug 18, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Aug 18, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants