vue基于element-ui 的后台管理框架(一)


1.安装element-ui 运行命令 npm i element-ui -S

2.安装路由 运行命令   npm install vue-router

使用:在index.js中引入  

import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

路由配备:引入模块

import HelloWorld from '../components/HelloWorld' //登录页


export default new Router({
routes: [
{
path: '/',
redirect: 'login'
},
{
path: '/login',
component: HelloWorld,
},
]
})
上面的写法是默认打开登录页(系统刚打开就是登录页)

2.http请求 运行命令 npm install vue-resource(相当于$.ajax)

在主页面引用:

import VueResource from 'vue-resource'
Vue.use(VueResource)
在页面使用方式可以直接使用

this.$http.get('/someUrl').then(response => {
 
    // get body data(请求到数据以后)
    cosnole.log(response.data);
 
  }response => {
    // error callback (发送请求失败)
  });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM