# 外送平台 Vue APP(分析應用的整個Vue組件結構)
> src
>>components-----非路由組件文件夾
>>> FooterGuide-----底部組件文件夾
>>>> FooterGuide.vue-----底部組件vue
>>>>
>>page-----路由組件文件夾
>>>Miste-----首頁組件資料夾
>>>>Miste.vue----首頁組件vue
>>>>
>>>Search-----首頁組件資料夾
>>>>Search.vue----首頁組件vue
>>>>
>>>Order-----首頁組件資料夾
>>>>Order.vue----首頁組件vue
>>>>
>>>Profile-----首頁組件資料夾
>>>>Profile.vue----首頁組件vue
>>>>
>>App.vue-----應用根組件vu
>>main.js-----應用入口js
>>
# 各組件基本代碼
vue文件代碼
```htmlmixed=
<template>
<div>vue template</div>
</template>
<script>
export default {
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
</style>
```
---
main.js代碼
```htmlmixed=
import Vue from 'vue'
import App from './App'
/* eslint-disable no-new */
new Vue({
el: '#app',
render: h => h(App)
})
```
引入reset樣式
```htmlembedded=
/**
* Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)
* http://cssreset.com
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header,
menu, nav, output, ruby, section, summary,
time, mark, audio, video, input {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font-weight: normal;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* custom */
a {
color: #7e8c8d;
text-decoration: none;
-webkit-backface-visibility: hidden;
}
li {
list-style: none;
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
}
::-webkit-scrollbar-track-piece {
background-color: rgba(0, 0, 0, 0.2);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:vertical {
height: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
::-webkit-scrollbar-thumb:horizontal {
width: 5px;
background-color: rgba(125, 125, 125, 0.7);
-webkit-border-radius: 6px;
}
html, body {
width: 100%;
height: 100%;
}
body {
-webkit-text-size-adjust: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/*顯示省略號*/
.ellipsis{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
```
index.html中引入
```htmlmixed=
<link rel="stylesheet" href="/static/css/reset.css">
```
移動端
1. viewport
```htmlmixed=
<meta name="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,u
ser-scalable=no">
```
2. 解決點擊響應延遲0.3秒問題
```htmlmixed=
<script
src="https://as.alipayobjects.com/g/component/fastclick/1.0.6/fastclick.js"></scrip
t>
<script>
if ('addEventListener' in document) {
document.addEventListener('DOMContentLoaded', function() {
FastClick.attach(document.body);
}, false);
}
if(!window.Promise) {
document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"
'+'>'+'<'+'/'+'script>');
}
</script>
```
###### tags: `Vue`