import axios from ‘axios‘export default { name: "AjaxText", data: function () { return { message: {} } }, mounted() { this.cartView(); }, methods:{ cartView() { let vm=this; axios.get("/static/sites.json", {}).then(function (response) { vm.message = response.data; }) } }} webstrom创建的vue项目,本地json要放在static文件夹下
原文地址:https://www.cnblogs.com/wangpeili/p/9503093.html
时间: 2024-10-08 09:57:17