chore: add i18n support for TabsView.vue; 🌟

master
chenghongxing 4 years ago
parent 3573a51dbd
commit 886a19ddfc
  1. 16
      src/layouts/tabs/TabsView.vue
  2. 17
      src/utils/request.js

@ -40,16 +40,18 @@ export default {
return { return {
pageList: [], pageList: [],
activePage: '', activePage: '',
menuVisible: false, menuVisible: false
menuItemList: [
{ key: '1', icon: 'arrow-left', text: '关闭左侧' },
{ key: '2', icon: 'arrow-right', text: '关闭右侧' },
{ key: '3', icon: 'close', text: '关闭其它' }
]
} }
}, },
computed: { computed: {
...mapState('setting', ['multiPage', 'animate', 'layout', 'dustbins', 'routesI18n']) ...mapState('setting', ['multiPage', 'animate', 'layout', 'dustbins', 'routesI18n']),
menuItemList() {
return [
{ key: '1', icon: 'vertical-right', text: this.$t('closeLeft') },
{ key: '2', icon: 'vertical-left', text: this.$t('closeRight') },
{ key: '3', icon: 'close', text: this.$t('closeOthers') }
]
}
}, },
created () { created () {
const route = this.$route const route = this.$route

@ -3,10 +3,10 @@ import Cookie from 'js-cookie'
axios.defaults.timeout = 5000 axios.defaults.timeout = 5000
axios.defaults.withCredentials= true axios.defaults.withCredentials= true
const cookies = Cookie.get() // const cookies = Cookie.get()
Object.keys(cookies).forEach(key => { // Object.keys(cookies).forEach(key => {
axios.defaults.headers.common[key] = cookies[key] // axios.defaults.headers.common[key] = cookies[key]
}) // })
const METHOD = { const METHOD = {
GET: 'get', GET: 'get',
@ -21,13 +21,16 @@ const METHOD = {
* @returns {Promise<AxiosResponse<T>>} * @returns {Promise<AxiosResponse<T>>}
*/ */
async function request(url, method, params) { async function request(url, method, params) {
// header 加入 token
const token = Cookie.get('Authorization')
const config = token ? {headers: {Authorization: token}} : {}
switch (method) { switch (method) {
case METHOD.GET: case METHOD.GET:
return axios.get(url, {params}) return axios.get(url, {params, ...config})
case METHOD.POST: case METHOD.POST:
return axios.post(url, params) return axios.post(url, params, config)
default: default:
return axios.get(url, {params}) return axios.get(url, {params, ...config})
} }
} }

Loading…
Cancel
Save