企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 1. 注册全局方法(main.js) > 假设已有`/common/httpRequest.js` ``` import HttpRequest from './common/httpRequest' Vue.prototype.$Request = HttpRequest; const app = new Vue({ ...App }); app.$mount(); ``` ### 2. test.vue 使用 ``` <script> export default { data() { return { title: 'Hello' } }, onLoad() { this.loadBanner(); }, methods: { loadBanner: function() { this.$Request.get('/tao/banner/user/list').then(res => { if (res.status === 0) { this.banners = res.data; } }); }, } } </script> ```