博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vue+Element实现静态旅游网站
阅读量:4448 次
发布时间:2019-06-07

本文共 2597 字,大约阅读时间需要 8 分钟。

页面效果:

 

1.用vue脚手架:vue-cli,新建一个vue项目。

2.npm run dev后,给小颖了一句提示:Your application is running here:http://localhost:8080/   ,小颖比较懒,觉得还是喜欢以前那种执行完npm run dev后,会在你默认的浏览器中自动打开http://localhost:8080/ ,所以小颖将提示语删了:

再给package.json中加入:

我不想用8080端口号,所以在package.json中将端口号修改为:8086

3.项目运行后发现,老是加一个  “/#/”  的后缀,解决方法:

4.引入element-ui:npm install  element-ui  --save

main.js

import Vue from 'vue'import App from './App'import ElementUI from 'element-ui'import 'element-ui/lib/theme-chalk/index.css'import router from './router'Vue.use(ElementUI)Vue.config.productionTip = false/* eslint-disable no-new */new Vue({  el: '#app',  router,  template: '
', components: { App }})

 接下来根据所需,新增、修改相应文件。

项目目录:

修改:index.js,还是因为懒,所以后面几个路由都配置成一样的。嘻嘻

import Vue from 'vue'import Router from 'vue-router'import helloWorld from '@/components/HelloWorld'import index from '@/pages/index'Vue.use(Router)export default new Router({  mode: 'history',  routes: [{    path: '/',    name: 'index',    component: index  }, {    path: '/helloWorld',    name: 'helloWorld',    component: helloWorld  },{    path: '/a',    name: 'helloWorld',    component: helloWorld  },{    path: '/b',    name: 'helloWorld',    component: helloWorld  },{    path: '/c',    name: 'helloWorld',    component: helloWorld  },{    path: '/d',    name: 'helloWorld',    component: helloWorld  }]})

修改:App.vue

新增:index.vue

 git地址:

转载于:https://www.cnblogs.com/yingzi1028/p/8270225.html

你可能感兴趣的文章
设计模式学习笔记(总结篇:模式分类)
查看>>
算法笔记_075:蓝桥杯练习 最短路(Java)
查看>>
TCP的三次握手/建立连接
查看>>
Python 教程阅读笔记(一):使用解释器
查看>>
运算符重载
查看>>
SDWebImage 新版接口使用方法
查看>>
iPhone 和 Galaxy高速拍照原理具体分析
查看>>
简单的jQuery检测注册用户名
查看>>
DataTable导出为word,excel,html,csv,pdf,.txt
查看>>
android ListView详解
查看>>
使用excel估计GARCH模型参数——以GARCH(1,1)为例
查看>>
软件工程 第一次作业
查看>>
Content Server HA搭建
查看>>
vue-textarea 自适应高度
查看>>
(2)数据结构——线性表(链表)实现
查看>>
[leetCode]Linked List Cycle I+II
查看>>
leetcode中的python学习
查看>>
sqlserver打开对象资源管理器管理的帮助文档的快捷键
查看>>
php 解决乱码的通用方法
查看>>
spring aop annotation
查看>>