欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于vue-cli vue-router搭建底部導(dǎo)航欄移動(dòng)前端項(xiàng)目

 更新時(shí)間:2018年02月28日 09:51:36   作者:澹臺(tái)宇鵬  
這篇文章主要介紹了基于vue-cli vue-router搭建底部導(dǎo)航欄移動(dòng)前端項(xiàng)目,項(xiàng)目中主要用了Flex布局,以及viewport相關(guān)知識(shí),已達(dá)到適應(yīng)各終端屏幕的目的。需要的朋友可以參考下

vue.js學(xué)習(xí) 踩坑第一步

1.首先安裝vue-cli腳手架

不多贅述,主要參考 Vue 爬坑之路(一)—— 使用 vue-cli 搭建項(xiàng)目

 

2.項(xiàng)目呈現(xiàn)效果

項(xiàng)目呈現(xiàn)網(wǎng)址:www.zhoupeng520.cn/index.html 

項(xiàng)目中主要用了Flex布局,以及viewport相關(guān)知識(shí),已達(dá)到適應(yīng)各終端屏幕的目的

3.項(xiàng)目主要目錄

4主要代碼如下 

(1)App.vue

<template>
 <div id="app">
 <router-view class="view"></router-view>
 <div class="nav">
  <router-link class="nav-item" to="/langren">狼人殺</router-link>
  <router-link class="nav-item" to="/sanguo">三國殺</router-link>
  <router-link class="nav-item" to="/yingxiong">英雄殺</router-link>
 </div>
 </div>
</template>
<script>
</script>
<style>
 #app{
 height: 100%;
 display: flex;
 flex-direction: column;
 flex: 1;
 }
 .nav{
 height: 80px;
 line-height: 80px;
 display: flex;
 text-align: center;
 }
 .nav-item{
 flex: 1;
 text-decoration: none;
 }
 .nav-item:link,.nav-item:visited{
 background-color: white;
 color: black;
 }
 .nav-item:hover,.nav-item:active{
 color: white;
 background-color: #C8C6C6;
 }
</style>

(2)main.js

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue';
import VueRouter from 'vue-router';
import router from './router';
import App from './App';
Vue.config.productionTip = false;
Vue.use(VueRouter);
/* eslint-disable no-new */
new Vue({
 el: '#app',
 router,
 template: '</App>',
 render: h => h(App)
});

(3)index.js //這個(gè)就是路由的配置

這個(gè)可以直接寫進(jìn)main.js 也可像我一樣在main.js中引入,各有各的好處

import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter);

const router = new VueRouter({
 routes: [{
  path: '/langren',
  component: require('../components/vue/langren.vue')
 }, {
  path: '/sanguo',
  component: require('../components/vue/sanguo.vue')
 }, {
  path: '/yingxiong',
  component: require('../components/vue/yingxiong.vue')
 }, {
  path: '/',
  component: require('../components/content/content.vue')
 }]
});
export default router;

也可以直接寫一個(gè)routers.js放在src目錄下

(4)router.js

import langren from './components/vue/langren.vue';
import sanguo from './components/vue/sanguo.vue';
import yingxiong from './components/vue/yingxiong.vue';
const routers = [
 {
  path: '/langren',
  component: langren
 },
 {
  path: '/sanguo',
  component: sanguo
 },
 {
  path: '/yingxiong',
  component: yingxiong
 }
];
export default routers;

(5)content.vue

<template>
 <div class="content"><p>我是content!</p></div>
</template>
<script type="text/ecmascript-6">
 export default {};
</script>
<style lang="stylus" rel="stylesheet/stylus">
 .content
  height:100%
  background:blue
  flex:1
  display:flex;
  justify-content:center
  align-items:center
</style>

langren.vue / sanguo.vue / yingxiong.vue 代碼和這個(gè)一樣只是顏色和p中字段改了下。

主要代碼就這些了。 

5.另外寫一下主要遇到的報(bào)錯(cuò)以及解決方法

(1)由于是用來es6的語法,所以要遵循它 的一些語法規(guī)則,所以有的代碼最后要多一行空行,有的要加分號(hào),有的要加空格,根據(jù)報(bào)錯(cuò)來進(jìn)行更改

(2)semi//indent//no-tabs報(bào)錯(cuò),在.eslintrc.js更改代碼如下,主要添加了最后幾行。

// http://eslint.org/docs/user-guide/configuring
module.exports = {
 root: true,
 parser: 'babel-eslint',
 parserOptions: {
 sourceType: 'module'
 },
 env: {
 browser: true,
 },
 // https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
 extends: 'standard',
 // required to lint *.vue files
 plugins: [
 'html'
 ],
 // add your custom rules here
 'rules': {
 // allow paren-less arrow functions
 'arrow-parens': 0,
 // allow async-await
 'generator-star-spacing': 0,
 // allow debugger during development
 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
 'semi': ['error', 'always'],
 'indent': 0,
 'space-before-function-paren': 0,
 "no-tabs":"off"
 }
}

總結(jié)

以上所述是小編給大家介紹的基于vue-cli vue-router搭建底部導(dǎo)航欄移動(dòng)前端項(xiàng)目,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

  • 關(guān)于element的表單組件整理筆記

    關(guān)于element的表單組件整理筆記

    這篇文章主要給大家介紹了關(guān)于element的表單組件的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02
  • 微信小程序開發(fā)實(shí)現(xiàn)消息框彈出

    微信小程序開發(fā)實(shí)現(xiàn)消息框彈出

    在小程序的wxml文件中創(chuàng)建消息框,消息框一般包含要提示的消息內(nèi)容以及確認(rèn)和取消按鈕,在小程序的wxss文件中定義消息框的樣式,在小程序的js文件中,我們需要通過Animation對(duì)象實(shí)現(xiàn)消息框的彈出動(dòng)畫
    2023-12-12
  • vue組件中添加@click失效問題及解決

    vue組件中添加@click失效問題及解決

    這篇文章主要介紹了vue組件中添加@click失效問題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • vue打包后dist文件在本地啟動(dòng)運(yùn)行的步驟

    vue打包后dist文件在本地啟動(dòng)運(yùn)行的步驟

    這篇文章主要給大家介紹了關(guān)于vue打包后dist文件在本地啟動(dòng)運(yùn)行的簡單步驟,文中通過代碼示例以及圖文介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用vue具有一定的參考價(jià)值,需要的朋友可以參考下
    2023-09-09
  • 基于vue.js實(shí)現(xiàn)圖片輪播效果

    基于vue.js實(shí)現(xiàn)圖片輪播效果

    這篇文章主要為大家詳細(xì)介紹了基于vue.js實(shí)現(xiàn)圖片輪播效果,vue如何實(shí)現(xiàn)輪播圖效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • vue 使用post/get 下載導(dǎo)出文件操作

    vue 使用post/get 下載導(dǎo)出文件操作

    這篇文章主要介紹了vue 使用post/get 下載導(dǎo)出文件操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • VUE中setTimeout和setInterval自動(dòng)銷毀案例

    VUE中setTimeout和setInterval自動(dòng)銷毀案例

    這篇文章主要介紹了VUE中setTimeout和setInterval自動(dòng)銷毀案例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • vue實(shí)現(xiàn)頭像上傳功能

    vue實(shí)現(xiàn)頭像上傳功能

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)頭像上傳功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-07-07
  • vue獲取el-form的整體驗(yàn)證狀態(tài)

    vue獲取el-form的整體驗(yàn)證狀態(tài)

    本文主要介紹了vue獲取el-form的整體驗(yàn)證狀態(tài),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • 如何在在Vue3中使用markdown 編輯器組件

    如何在在Vue3中使用markdown 編輯器組件

    vue3發(fā)布正式版不久,生態(tài)還沒完全發(fā)展起來,目前支持vue3的開源markdown編輯器組件基本上也寥寥無幾,向大家推薦一個(gè)很好用的v-md-editor 組件,組件功能很強(qiáng)大,文檔也比較詳細(xì)。該文章只介紹組件的常用功能,更多高級(jí)的功能可以參考官方文檔。
    2021-05-05

最新評(píng)論