npm install xe-ajax vxe-ajax --save
import Vue from 'vue' import XEAjax from 'xe-ajax' import VXEAjax from 'vxe-ajax' Vue.use(VXEAjax, XEAjax)
<template> <ul> <li v-for="(item, index) in list" :key="index">{{ item.name }}</li> </ul> </template>
<script> export default { name: 'App', data: { return { list: [] } }, created () { this.$ajax.fetch('/api/user/list').then(response => { response.json().then(data => { this.list = data }) }) } } </script>