vue+mongodb+nodejs的express框架实现登录注册前台完整案例及源码(1)

import router from ‘./router’

import axios from ‘axios’

Vue.prototype.axios = axios

// 原生ajax、axios请求时,如果不显示的设置Content-Type,那么默认是text/plain,这时服务器就不知道怎么解析数据了,所以才只能通过获取原始数据流的方式来进行解析请求数据。

axios.defaults.headers.post[‘Content-Type’] = ‘application/x-www-form-urlencoded’

Vue.config.productionTip = false

new Vue({

router,

render: h => h(App)

}).$mount(‘#app’)

app.vue

Vue logo

router/index.js

import Vue from ‘vue’

import Router from ‘vue-router’

import Login from ‘@/pages/Login.vue’

import Main from ‘@/pages/Main.vue’

import Home from ‘@/pages/Home.vue’

Vue.use(Router)

export default new Router({

mode: ‘history’,

routes: [

{

path: ‘/’,

name: ‘Login’,

component: Login

}, {

path: ‘/main’,

name: ‘Main’,

component: Main

}, {

path: ‘/home’,

name: ‘Home’,

component: Home

}

]

})

pages/Home.vue

欢迎 {{name}}

<a href=“#” @click=“quit”>注销登录

pages/Login.vue

登录

{{tishi}}

登录

没有账号?马上注册

注册

{{tishi}}

注册

已有账号?马上登录

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值