Skip to content

[Bug Report] 关于toolbar自定义按钮移动端点击事件的问题 #1626

@CitizensLi

Description

@CitizensLi

Prerequisites

Version

0.10.3

Reproduction Link

No response

Describe the Bug

我自定义的按钮:

toolbars: {
          customMenu: {
            articleTheme: Cherry.createMenuHook('编辑器主题', {
              iconName: 'iconfont icon-editor-theme',
              onClick: (selection) => {
                this.showArticleThemeSelectVisible = true;
                console.log("点击了编辑器主题按钮",selection,this,this.showArticleThemeSelectVisible)

               this.testVal = this.testVal+1;
                setTimeout(() =>{
                  console.log(this.showArticleThemeSelectVisible,this.testVal)
                },3000)
              }
            }),
          },
    其它代码......
}

在处理时遇到了一个问题:
当在桌面端点击按钮时,能够正常的变更showArticleThemeSelectVisible 值

但是在移动端点击按钮时,showArticleThemeSelectVisible 值会被变更,但瞬间又被变更了回来,但是我测试的testVal却能够被正常增长,这是为什么?

另外,在移动端长按按钮时,却又可以正常的变更showArticleThemeSelectVisible 值

这个showArticleThemeSelectVisible 绑定的是一个vant UI的popup,整个页面的template部分的内容如下:

<template>
  <div id="document-content" class="document-content" >
    <van-popup safe-area-inset-bottom v-model="showArticleThemeSelectVisible" round position="bottom">
      <van-picker
          show-toolbar
          :columns="ArticleThemeList"
          @cancel="cancelSelectArticleTheme"
          :close-on-click-overlay="false"
          value-key="label"
          @confirm="confirmSelectArticleTheme"
      />
    </van-popup>
  </div>
</template>

如果是我的设置问题,还烦请指出

对了,我的项目中还引入了:
import '@vant/touch-emulator';
import VueTouch from 'vue-touch'
Vue.use(VueTouch)

System Information

System:
    OS: Windows 11 10.0.26200
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 5.98 GB / 31.86 GB
  Binaries:
    Node: 20.19.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Users\lijun\AppData\Roaming\npm\yarn.CMD
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 139.0.7258.157
    Edge: Chromium (139.0.3405.125)
    Firefox: 147.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
    Internet Explorer: 11.0.26100.7309

Contributing

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-no-confirmedThe direction of this issue has not yet been determined.🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions