| | |
| | | <router-view /> |
| | | </div> |
| | | </template> |
| | | |
| | | <style > |
| | | |
| | | </style> |
| | | <script> |
| | | export default { |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | mytitle: '', |
| | | } |
| | | }, |
| | | async created() { |
| | | const imgObj = await this.getIcon(); |
| | | this.changIcon(imgObj); |
| | | }, |
| | | methods: { |
| | | changIcon(obj) { |
| | | var link = document.querySelector("link [rel*='icon']") || document.createElement("link"); |
| | | var title = document.querySelector("title") || document.createElement("title"); |
| | | link.type = "image/x-icon"; |
| | | link.rel = "shortcut icon"; |
| | | link.href = obj.chromeLinkUrl; //icon图标 |
| | | title.innerHTML = obj.title; |
| | | document.getElementsByTagName("head")[0].appendChild(link); |
| | | document.getElementsByTagName("head")[0].appendChild(title); |
| | | }, |
| | | // 获取icon |
| | | async getIcon() { |
| | | let result; |
| | | const pic = JSON.parse(localStorage.getItem('pic')); |
| | | if (pic) { |
| | | result = pic; |
| | | console.log('缓存') |
| | | } else { |
| | | console.log('请求'); |
| | | await this.$axios({ |
| | | method: 'get', |
| | | url: 'sccg/system/portal/logo/search', |
| | | }).then(res => { |
| | | console.log(res); |
| | | result = res.data; |
| | | localStorage.setItem('pic',JSON.stringify(result)); |
| | | }) |
| | | } |
| | | return result; |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | </script> |
| | | <style> |
| | | |
| | | </style> |