Skip to content

Commit fd0e0e4

Browse files
committed
- [新增] 引入fastclick解决移动端点击事件延迟300ms问题
1 parent 649d729 commit fd0e0e4

File tree

10 files changed

+83
-109
lines changed

10 files changed

+83
-109
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
"dependencies": {
1111
"core-js": "^2.6.5",
12+
"fastclick": "^1.0.6",
1213
"vue": "^2.6.10",
1314
"vue-router": "^3.0.3",
1415
"vuex": "^3.0.1"

src/App.vue

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,11 @@
11
<template>
22
<div id="app">
3-
<div id="nav">
4-
<router-link to="/">Home</router-link> |
5-
<router-link to="/about">About</router-link>
6-
</div>
73
<router-view/>
84
</div>
95
</template>
106

117
<style lang="less">
128
#app {
13-
font-family: 'Avenir', Helvetica, Arial, sans-serif;
14-
-webkit-font-smoothing: antialiased;
15-
-moz-osx-font-smoothing: grayscale;
16-
text-align: center;
17-
color: #2c3e50;
18-
}
19-
#nav {
20-
padding: 30px;
21-
a {
22-
font-weight: bold;
23-
color: #2c3e50;
24-
&.router-link-exact-active {
25-
color: #42b983;
26-
}
27-
}
9+
2810
}
2911
</style>

src/components/HelloWorld.vue

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,25 @@
1+
/**Created by MonTage_fz on 2019/9/25**/
12
<template>
2-
<div class="hello">
3-
<h1>{{ msg }}</h1>
4-
<p>
5-
For a guide and recipes on how to configure / customize this project,<br>
6-
check out the
7-
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
8-
</p>
9-
<h3>Installed CLI Plugins</h3>
10-
<ul>
11-
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
12-
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
13-
</ul>
14-
<h3>Essential Links</h3>
15-
<ul>
16-
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
17-
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
18-
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
19-
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
20-
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
21-
</ul>
22-
<h3>Ecosystem</h3>
23-
<ul>
24-
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
25-
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
26-
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
27-
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
28-
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
29-
</ul>
30-
</div>
3+
<div class="HelloWorld">
4+
5+
</div>
316
</template>
327

338
<script>
34-
export default {
35-
name: 'HelloWorld',
36-
props: {
37-
msg: String
38-
}
39-
}
9+
export default {
10+
name: 'HelloWorld',
11+
components: {},
12+
data() {
13+
return {};
14+
},
15+
created() {
16+
},
17+
computed: {},
18+
methods: {},
19+
};
4020
</script>
4121

42-
<!-- Add "scoped" attribute to limit CSS to this component only -->
4322
<style scoped lang="less">
44-
h3 {
45-
margin: 40px 0 0;
46-
}
47-
ul {
48-
list-style-type: none;
49-
padding: 0;
50-
}
51-
li {
52-
display: inline-block;
53-
margin: 0 10px;
54-
}
55-
a {
56-
color: #42b983;
57-
}
23+
.HelloWorld {
24+
}
5825
</style>

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import App from './App.vue';
33
import router from './router';
44
import store from './store';
55
import './styles';
6+
import tools from './tools';
67

78
Vue.config.productionTip = false;
8-
9+
Vue.use(tools);
910
new Vue({
1011
router,
1112
store,

src/router/index.js

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
import Vue from 'vue'
2-
import Router from 'vue-router'
3-
import Home from '../views/Home.vue'
1+
import Vue from 'vue';
2+
import Router from 'vue-router';
3+
import Home from '../views/Home.vue';
44

5-
Vue.use(Router)
5+
Vue.use(Router);
66

77
export default new Router({
8-
mode: 'history',
9-
base: process.env.BASE_URL,
10-
routes: [
11-
{
12-
path: '/',
13-
name: 'home',
14-
component: Home
15-
},
16-
{
17-
path: '/about',
18-
name: 'about',
19-
// route level code-splitting
20-
// this generates a separate chunk (about.[hash].js) for this route
21-
// which is lazy-loaded when the route is visited.
22-
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
23-
}
24-
]
25-
})
8+
mode: 'history',
9+
base: process.env.BASE_URL,
10+
routes: [
11+
{
12+
path: '/',
13+
name: 'home',
14+
component: Home,
15+
},
16+
],
17+
});

src/tools/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Created by MonTage_fz on 2019/9/25
3+
*/
4+
import fastClick from 'fastclick';
5+
6+
fastClick.attach(document.body);
7+
8+
export default () => {
9+
}

src/views/About.vue

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/views/Home.vue

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<template>
2-
<div class="home">
3-
<img alt="Vue logo" src="../assets/logo.png">
4-
<HelloWorld msg="Welcome to Your Vue.js App"/>
5-
</div>
2+
<div class="home">
3+
hello
4+
</div>
65
</template>
76

87
<script>
9-
// @ is an alias to /src
10-
import HelloWorld from '@/components/HelloWorld.vue'
8+
// @ is an alias to /src
9+
import HelloWorld from '@/components/HelloWorld.vue';
1110
12-
export default {
13-
name: 'home',
14-
components: {
15-
HelloWorld
16-
}
17-
}
11+
export default {
12+
name: 'home',
13+
components: {
14+
HelloWorld,
15+
},
16+
};
1817
</script>

vue.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Created by MonTage_fz on 2019/9/25
3+
*/
4+
5+
module.exports = {
6+
7+
};

webStomAlias.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Created by MonTage_fz on 2019/9/25
3+
*/
4+
5+
const path = require('path');
6+
7+
module.exports = {
8+
context: path.resolve(__dirname, './'),
9+
resolve: {
10+
extensions: ['.js', '.vue', '.json'],
11+
alias: {
12+
'@': path.resolve('src'),
13+
'@assets': path.resolve(__dirname, 'src/assets'),
14+
'@pages': path.resolve(__dirname, 'src/pages'),
15+
'@comp': path.resolve(__dirname, 'src/components'),
16+
'@api': path.resolve(__dirname, 'src/api'),
17+
'@plug': path.resolve(__dirname, 'src/plugins'),
18+
'@utils': path.resolve(__dirname, 'src/utils'),
19+
},
20+
},
21+
};

0 commit comments

Comments
 (0)