From 9e0e41d86032c19e14a0ab22dfcc46846546233b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E7=9F=A5=E7=81=AB=20Shiranui?= Date: Fri, 11 Oct 2024 11:52:12 +0800 Subject: [PATCH] fix(axios.js): axios-x --- src/plugins/axios.js | 8 +++----- src/plugins/sara.js | 15 +++++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/plugins/axios.js b/src/plugins/axios.js index da2cf59..2239706 100644 --- a/src/plugins/axios.js +++ b/src/plugins/axios.js @@ -32,12 +32,10 @@ axiosClient.interceptors.response.use( const extension = { install: (Vue) => { - Vue.axios = axiosClient; window.axios = axiosClient; - Object.defineProperties(Vue.prototype, { - axios: axiosClient, - $axios: axiosClient, - }); + Vue.axios = axiosClient; + Vue.prototype.axios = axiosClient; + Vue.prototype.$axios = axiosClient; }, }; diff --git a/src/plugins/sara.js b/src/plugins/sara.js index 1de84e8..ede78ea 100644 --- a/src/plugins/sara.js +++ b/src/plugins/sara.js @@ -72,16 +72,15 @@ const getProfile = async () => { const extension = { install: (Vue) => { - Vue.sara = axiosClient; - Vue.profile = getProfile; window.sara = axiosClient; + Vue.sara = axiosClient; + Vue.prototype.sara = axiosClient; + Vue.prototype.$sara = axiosClient; + window.profile = getProfile; - Object.defineProperties(Vue.prototype, { - sara: axiosClient, - $sara: axiosClient, - profile: getProfile, - $profile: getProfile, - }); + Vue.profile = getProfile; + Vue.prototype.profile = getProfile; + Vue.prototype.$profile = getProfile; }, };