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

Vue 项目中获取不到 editor 组件的 context 对象 #8425

Closed
cheese-git opened this issue Jan 4, 2021 · 1 comment
Closed

Vue 项目中获取不到 editor 组件的 context 对象 #8425

cheese-git opened this issue Jan 4, 2021 · 1 comment
Labels
F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@cheese-git
Copy link
Contributor

相关平台

微信小程序

复现仓库

https://github.com/cheese-git/issue-taro-vue2-editor
小程序基础库: 2.14.1
使用框架: Vue 2

复现步骤

npm run dev:weapp

期望结果

能够成功获取 EditorContext

实际结果

获取不到 EditorContext

环境信息

Taro CLI 3.0.21 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.15.1 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.10 - C:\Users\Administrator\AppData\Roaming\npm\node_modules\yarn\bin\yarn.CMD
      npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
@taro-bot2 taro-bot2 bot added F-vue2 Framework - Vue 2 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jan 4, 2021
@Chen-jj
Copy link
Contributor

Chen-jj commented Aug 24, 2021

在 onReady 中再获取小程序 dom

- mounted () {
+ onReady () {
    const page = Taro.getCurrentInstance().page
    // @ts-ignore
    page.createSelectorQuery().select('#editor1').context(res => {
      console.log(res)
      // null
    }).exec()

    Taro.createSelectorQuery().select('#editor1').context(res => {
      console.log(res)
      // null
    }).exec()
  }

image

@Chen-jj Chen-jj closed this as completed Aug 24, 2021
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