问题描述
微信自定义嵌套组件里不支持 kebab-case
写法的事件,驼峰写法是没问题的。
复现步骤
复现代码:https://github.com/auven/vant-weapp-example-uni-app/blob/master/src/pages/test-van-popup/index.vue ,可以 clone 下来看看
<view>
<van-cell title="事件名 kebab-case 写法" is-link bind:click="showPopup" />
<van-popup
show="{{ show }}"
round
position="bottom"
custom-style="height: 20%"
bind:close="onClose"
bind:click-overlay="onClickOverlay" <--- 无法执行
bind:before-enter="onBeforeEnter" <--- 无法执行
bind:enter="onEnter"
bind:after-enter="onAfterEnter" <--- 无法执行
bind:before-leave="onBeforeLeave" <--- 无法执行
bind:leave="onLeave"
bind:after-leave="onAfterLeave" <--- 无法执行
/>
<van-cell title="事件名 PascalCase 写法" is-link bind:click="showPopup1" />
<van-popup
show="{{ show1 }}"
round
position="bottom"
custom-style="height: 20%"
bind:close="onClose1"
bind:clickOverlay="onClickOverlay" <--- 正常执行
bind:beforeEnter="onBeforeEnter" <--- 正常执行
bind:enter="onEnter"
bind:afterEnter="onAfterEnter" <--- 正常执行
bind:beforeLeave="onBeforeLeave" <--- 正常执行
bind:leave="onLeave"
bind:afterLeave="onAfterLeave" <--- 正常执行
/>
</view>
预期结果
支持在微信自定义嵌套组件使用 kebab-case
写法的事件。
实际结果
在使用 vant-weapp
的 van-dropdown-menu
时 closed
事件没执行,因为其内部嵌套了 van-popup
,而 closed
事件是由 van-popup
的 after-leave
事件触发的。
系统信息:
uni-app v2.8.1
uni-app cli v2.0.0-alpha-28120200721001
Environment Info:
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: Not Found
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.89
Firefox: Not Found
Safari: 13.0.5
npmPackages:
@dcloudio/uni-app-plus: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-app-plus-nvue: 0.0.1
@dcloudio/uni-app-plus-nvue-v8: 0.0.1
@dcloudio/uni-automator: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-cli-shared: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-h5: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-helper-json: * => 1.0.5
@dcloudio/uni-migration: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-mp-alipay: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-mp-baidu: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-mp-qq: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-mp-toutiao: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/uni-mp-weixin: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-quickapp-light: ^2.0.0-26920200424005 => 2.0.0-26920200424005
@dcloudio/uni-quickapp-native: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-quickapp-vue: ^2.0.0-26920200424005 => 2.0.0-26920200424005
@dcloudio/uni-quickapp-webview: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/uni-stat: ^2.0.0-v3-24020191018001 => 2.0.0-v3-24020191018001
@dcloudio/uni-template-compiler: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/vue-cli-plugin-hbuilderx: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/vue-cli-plugin-uni: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/vue-cli-plugin-uni-optimize: ^2.0.0-alpha-28120200720003 => 2.0.0-alpha-28120200720003
@dcloudio/webpack-uni-mp-loader: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@dcloudio/webpack-uni-nvue-loader: 0.0.1
@dcloudio/webpack-uni-pages-loader: ^2.0.0-alpha-28120200721001 => 2.0.0-alpha-28120200721001
@hap-toolkit/dsl-vue: 0.6.13
@vue/babel-helper-vue-jsx-merge-props: 1.0.0
@vue/babel-plugin-transform-vue-jsx: 1.1.2
@vue/babel-preset-app: 4.4.6
@vue/babel-preset-jsx: 1.1.2
@vue/babel-sugar-functional-vue: 1.1.2
@vue/babel-sugar-inject-h: 1.1.2
@vue/babel-sugar-v-model: 1.1.2
@vue/babel-sugar-v-on: 1.1.2
@vue/cli-overlay: 4.4.6
@vue/cli-plugin-babel: ^4.4.6 => 4.4.6
@vue/cli-plugin-router: 4.4.6
@vue/cli-plugin-vuex: 4.4.6
@vue/cli-service: ^4.4.6 => 4.4.6
@vue/cli-shared-utils: 4.4.6
@vue/component-compiler-utils: 3.1.2 (3.1.2)
@vue/preload-webpack-plugin: 1.1.1
@vue/web-component-wrapper: 1.2.0
mpvue-page-factory: 1.0.1
mpvue-template-compiler: 1.0.13
uni-h5-vue: 2.6.10
uni-mp-vue: 2.6.10
vue: ^2.6.11 => 2.6.11
vue-hot-reload-api: 2.3.4
vue-loader: 15.9.1 (15.9.3, 15.9.1)
vue-router: 3.0.1
vue-style-loader: 4.1.2
vue-template-compiler: ^2.6.11 => 2.6.11
vue-template-es2015-compiler: 1.9.1
vuex: ^3.5.1 => 3.5.1
npmGlobalPackages:
@vue/cli: 4.3.1
2条答案
按热度按时间iqxoj9l91#
@fxy060608 你好,有关注这个问题么?
pnwntuvh2#
项上去,支持修改