Skip to content

Commit

Permalink
- [新增] 引入fastclick解决移动端点击事件延迟300ms问题
Browse files Browse the repository at this point in the history
  • Loading branch information
montage-f committed Sep 25, 2019
1 parent 649d729 commit fd0e0e4
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 109 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"dependencies": {
"core-js": "^2.6.5",
"fastclick": "^1.0.6",
"vue": "^2.6.10",
"vue-router": "^3.0.3",
"vuex": "^3.0.1"
Expand Down
20 changes: 1 addition & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div>
</template>

<style lang="less">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>
67 changes: 17 additions & 50 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -1,58 +1,25 @@
/**Created by MonTage_fz on 2019/9/25**/
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
<div class="HelloWorld">

</div>
</template>

<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
export default {
name: 'HelloWorld',
components: {},
data() {
return {};
},
created() {
},
computed: {},
methods: {},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
.HelloWorld {
}
</style>
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import App from './App.vue';
import router from './router';
import store from './store';
import './styles';
import tools from './tools';

Vue.config.productionTip = false;

Vue.use(tools);
new Vue({
router,
store,
Expand Down
36 changes: 14 additions & 22 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from '../views/Home.vue'
import Vue from 'vue';
import Router from 'vue-router';
import Home from '../views/Home.vue';

Vue.use(Router)
Vue.use(Router);

export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}
]
})
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'home',
component: Home,
},
],
});
9 changes: 9 additions & 0 deletions src/tools/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Created by MonTage_fz on 2019/9/25
*/
import fastClick from 'fastclick';

fastClick.attach(document.body);

export default () => {
}
5 changes: 0 additions & 5 deletions src/views/About.vue

This file was deleted.

23 changes: 11 additions & 12 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
<div class="home">
hello
</div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue';
export default {
name: 'home',
components: {
HelloWorld
}
}
export default {
name: 'home',
components: {
HelloWorld,
},
};
</script>
7 changes: 7 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Created by MonTage_fz on 2019/9/25
*/

module.exports = {

};
21 changes: 21 additions & 0 deletions webStomAlias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Created by MonTage_fz on 2019/9/25
*/

const path = require('path');

module.exports = {
context: path.resolve(__dirname, './'),
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.resolve('src'),
'@assets': path.resolve(__dirname, 'src/assets'),
'@pages': path.resolve(__dirname, 'src/pages'),
'@comp': path.resolve(__dirname, 'src/components'),
'@api': path.resolve(__dirname, 'src/api'),
'@plug': path.resolve(__dirname, 'src/plugins'),
'@utils': path.resolve(__dirname, 'src/utils'),
},
},
};

0 comments on commit fd0e0e4

Please sign in to comment.