taro
taro copied to clipboard
未找到 van-notify 节点,请确认 selector 及 context 是否正确
相关平台
微信小程序
小程序基础库: 2.24.3 使用框架: Vue 3
复现步骤
- ui组件库:
vant-weapp
- 在A页面中使用
<van-notify id="test-notify-id" />
(注:test-notify-id 为全局唯一id) - 编译项目:
NODE_ENV=production taro build --type weapp
- 进入A页面,查看渲染后的wxml
此时触发
Notify({ selector: '#test-notify-id', type: 'warning', message: 'test' })
表现是正常的 - 退出A页面,再重新进入A页面(第二次进入A页面),查看渲染后的wxml
id被替换成了随机字符串,导致
Notify()
失败,报错未找到 van-notify 节点,请确认 selector 及 context 是否正确
ps:NODE_ENV=production taro build --type weapp
编译才会有这种问题,taro build --type weapp
编译时id不会被替换
期望结果
设置了id的元素id保持不变
实际结果
id被替换成了随机字符串
环境信息
👽 Taro v3.4.10
Taro CLI 3.4.10 environment info:
System:
OS: Linux 4.4 Ubuntu 20.04.3 LTS (Focal Fossa)
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 16.13.0 - /usr/bin/node
Yarn: 1.22.15 - /usr/bin/yarn
npm: 8.3.1 - /usr/bin/npm
npmPackages:
@tarojs/components: 3.4.10 => 3.4.10
@tarojs/mini-runner: 3.4.10 => 3.4.10
@tarojs/runtime: 3.4.10 => 3.4.10
@tarojs/taro: 3.4.10 => 3.4.10
@tarojs/webpack-runner: 3.4.10 => 3.4.10
babel-preset-taro: 3.4.10 => 3.4.10
eslint-config-taro: 3.4.10 => 3.4.10
@longhaoteng 麻烦提供一下 Demo
@longhaoteng 麻烦提供一下 Demo
@Chen-jj 无法提供Demo,复现步骤写的很详细了
怎么打上question
标签了,这个问题属于bug
吧
任意设置了id(全局唯一)的元素,在二次进入页面后,id都会变成随机id
例:<view id="test_id" />
第一次进入页面
第二次进入页面
NODE_ENV=production
编译就能复现
@Chen-jj
我也遇到了,我也觉得这是一个严重BUG