Skip to content

Commit f63f43d

Browse files
committed
[menu component] add touchstart event listener
1 parent 1a42796 commit f63f43d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "flyme-ui",
3-
"version": "0.5.5",
3+
"version": "0.5.6",
44
"description": "一套基于 Vue.js 的响应式移动端 UI 组件库",
55
"main": "src/index.js",
66
"scripts": {

src/component/menu/menu.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444

4545
<template>
4646
<div class="fm-menu">
47-
<fm-icon @click.native="hide" id="more" color="#666"></fm-icon>
48-
<div v-if="show" @click="hide" class="fm-menu--background"></div>
47+
<fm-icon @click.native="show = true" id="more" color="#666"></fm-icon>
48+
<div v-if="show" @touchstart="hide" class="fm-menu--background"></div>
4949
<transition name="fm-menu--transition">
5050
<fm-list v-if="show">
5151
<slot></slot>
@@ -77,7 +77,9 @@
7777
},
7878
methods: {
7979
hide() {
80-
this.show ? history.back() : this.show = true;
80+
setTimeout(() => {
81+
history.back();
82+
}, 200); // 防止 touchstart 在菜单键范围内触发时再次打开菜单的问题
8183
},
8284
popstateEvent() {
8385
this.show = false;

0 commit comments

Comments
 (0)