add title从ini取

This commit is contained in:
gcw_IJ7DAiVL
2025-11-03 17:00:28 +08:00
parent 46c6b952fc
commit 802df4d446

View File

@ -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