Commit e495e4198f9a21b0dfdf6490bdec92f9edd4e9c6

Authored by liuqimichale
1 parent 145c620a

传值

src/components/home.vue
@@ -35,6 +35,30 @@ export default { @@ -35,6 +35,30 @@ export default {
35 created() { 35 created() {
36 setTimeout(() => { 36 setTimeout(() => {
37 this.handleHide() 37 this.handleHide()
  38 +
  39 + // $http.get('/user', {
  40 + // params: {
  41 + // ID: 12345
  42 + // }
  43 + // })
  44 + // .then(function (response) {
  45 + // console.log(response);
  46 + // })
  47 + // .catch(function (error) {
  48 + // console.log(error);
  49 + // });
  50 +
  51 + // $http.post('/user', {
  52 + // firstName: 'Fred',
  53 + // lastName: 'Flintstone'
  54 + // })
  55 + // .then(function (response) {
  56 + // console.log(response);
  57 + // })
  58 + // .catch(function (error) {
  59 + // console.log(error);
  60 + // });
  61 +
38 // 模拟请求 62 // 模拟请求
39 // this.$fetch('/api/v2/movie/top250').then((response) => { 63 // this.$fetch('/api/v2/movie/top250').then((response) => {
40 // console.log(response) 64 // console.log(response)
src/main.js
@@ -7,6 +7,8 @@ import store from './store/store' @@ -7,6 +7,8 @@ import store from './store/store'
7 import 'lib-flexible/flexible.js' 7 import 'lib-flexible/flexible.js'
8 import fastclick from 'fastclick' 8 import fastclick from 'fastclick'
9 import './styles/reset.css' 9 import './styles/reset.css'
  10 +import axios from 'axios'
  11 +Vue.prototype.$http = axios
10 12
11 fastclick.attach(document.body) 13 fastclick.attach(document.body)
12 14