代码分离,功能优化 (#204)
* feat: 代码分离,功能优化 1. 代码迁移到 ts. 2. 分离 axios 部分代码. 3. 增加 pinia 支持,全局状态代码迁移到相对应的 store. 4. 代码格式优化, 用 === 代替 ==. 5. 代码声明更改,用 const 代替 var 声明. 6. Header 使用 Router 导航. 7. v-for 增加 key. * fix[fe]: 移除过时的 prop 引用 * fix[fe]: 移除过时的 prop 引用 * fix[fe]: 修复 logo 上面有横线的问题 * fix[fe]: 修复 logo 上面有横线的问题 --------- Co-authored-by: zhe28 <huangze28@foxmail.com>
This commit is contained in:
1 parent
dbb671df67
commit
ad0167f6fd
20 files changed
+1640
-1638
No files matched your search
@@ -1,58 +1,49 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<input id="search" :placeholder="lang.search">
|
||||
<el-tree :data="data" :props="defaultProps" :defaultExpandAll="true" @node-click="handleNodeClick" :class="node" />
|
||||
<input id="search" :placeholder="lang.search" />
|
||||
<el-tree
|
||||
:data="data"
|
||||
:defaultExpandAll="true"
|
||||
@node-click="handleNodeClick"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { useRouter } from 'vue-router'
|
||||
import { reactive, ref } from 'vue'
|
||||
import useGroupStore from '../stores/group'
|
||||
import lang from '../i18n/i18n';
|
||||
import { getCurrentInstance } from 'vue'
|
||||
const app = getCurrentInstance()
|
||||
const $http = app.appContext.config.globalProperties.$http
|
||||
|
||||
const groupStore = useGroupStore()
|
||||
const router = useRouter()
|
||||
|
||||
|
||||
const data = ref([])
|
||||
|
||||
|
||||
$http.get('/api/group').then(res => {
|
||||
data.value = res.data
|
||||
})
|
||||
|
||||
import { useRouter } from "vue-router";
|
||||
import { ref } from "vue";
|
||||
import useGroupStore from "../stores/group";
|
||||
import lang from "../i18n/i18n";
|
||||
import { http } from "@/utils/axios";
|
||||
|
||||
const groupStore = useGroupStore();
|
||||
const router = useRouter();
|
||||
const data = ref([]);
|
||||
|
||||
http.get("/api/group").then((res) => {
|
||||
if (res.data) data.value = res.data;
|
||||
});
|
||||
|
||||
const handleNodeClick = function (data) {
|
||||
if (data.tag != null) {
|
||||
groupStore.name = data.label
|
||||
groupStore.tag = data.tag
|
||||
groupStore.name = data.label;
|
||||
groupStore.tag = data.tag;
|
||||
router.push({
|
||||
name: "list",
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
#main {
|
||||
width: 243px;
|
||||
background-color: #F1F1F1;
|
||||
background-color: #f1f1f1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#search {
|
||||
background-color: #D6E7F7;
|
||||
background-color: #d6e7f7;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
padding-left: 10px;
|
||||
@@ -62,10 +53,10 @@ const handleNodeClick = function (data) {
|
||||
}
|
||||
|
||||
.el-tree {
|
||||
background-color: #F1F1F1;
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
.add_group{
|
||||
.add_group {
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
padding-left: 15px;
|
||||
|
||||
Reference in new issue
Block a user