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