add title从ini取
This commit is contained in:
@ -16,13 +16,14 @@
|
||||
|
||||
<script>
|
||||
import {setStorage, getStorage} from '@/utils/localStorage.js'
|
||||
import iniParser from 'ini-parser'
|
||||
|
||||
export default {
|
||||
name: '',
|
||||
data() {
|
||||
return {
|
||||
tabList: [
|
||||
{id: 1, label: '机动路线规划'},
|
||||
{id: 1, label: '道路通过性分析'},
|
||||
// {id: 2, label: '临时部署驻地分析'},
|
||||
],
|
||||
activeIndex: 1,
|
||||
@ -30,12 +31,21 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.activeIndex = getStorage('activeIndex') || 1
|
||||
this.getTitle()
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
setStorage('activeIndex', 1)
|
||||
},
|
||||
methods: {
|
||||
getTitle() {
|
||||
fetch('./config.ini')
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
const parsedData = iniParser.parse(text);
|
||||
this.tabList[0].label = parsedData.title.msg || '道路通过性分析'
|
||||
});
|
||||
},
|
||||
setActiveIndex(id) {
|
||||
if (this.activeIndex !== id) {
|
||||
this.activeIndex = id
|
||||
|
||||
Reference in New Issue
Block a user