diff --git a/src/api/http.js b/src/api/http.js index dc84651..fe90d50 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -14,8 +14,8 @@ let loadingStatus = false; console.log(process.env.NODE_ENV, 'process.env.NODE_ENV') if (process.env.NODE_ENV == 'development') { // axios.defaults.baseURL = 'http://101.132.164.149:9991/'; - // axios.defaults.baseURL = 'http://8.153.108.90:9991/'; //测试 - axios.defaults.baseURL = 'https://smartsports.yuedongsports.com/'; //正式 + axios.defaults.baseURL = 'http://8.153.108.90:9991/'; //测试 + // axios.defaults.baseURL = 'https://smartsports.yuedongsports.com/'; //正式 // axios.defaults.baseURL = 'http://192.168.0.146:9991/'; //汤龙本地 // axios.defaults.baseURL = 'http://47.101.60.251:9991/'; // axios.defaults.baseURL = 'http://localhost:9991/'; diff --git a/src/components/basic/VolElementMenu.vue b/src/components/basic/VolElementMenu.vue index 5fd5317..645a15f 100644 --- a/src/components/basic/VolElementMenu.vue +++ b/src/components/basic/VolElementMenu.vue @@ -87,18 +87,18 @@ export default defineComponent({ } }); }; - let rootTreeId = !isNaN(props.rootId) ? ~~props.rootId : props.rootId; + let rootTreeId = ref(!isNaN(props.rootId) ? ~~props.rootId : props.rootId); props.list.forEach((x) => { if (!x.icon || x.icon.substring(0, 3) != 'el-') { x.icon = 'el-icon-menu'; } x.children = []; - x.isRoot = x.parentId === rootTreeId; + x.isRoot = x.parentId === rootTreeId.value; }); const convertTree = (data) => { var root_data = []; data.forEach((x) => { - if (x.parentId === rootTreeId) { + if (x.parentId === rootTreeId.value) { if (!x.hasOwnProperty('enable')) x.enable = 1; root_data.push(x); getTree(x.id, x, data); @@ -106,6 +106,14 @@ export default defineComponent({ }); return root_data; }; + // 监听 rootId 变化,重新生成树 + watch(() => props.rootId, (newVal) => { + rootTreeId.value = !isNaN(newVal) ? ~~newVal : newVal; + props.list.forEach((x) => { + x.children = []; + x.isRoot = x.parentId === rootTreeId.value; + }); + }); // const openedIds = reactive([props.currentMenuId]); // let openedIds = ref(['2', '2145', '2156', '2146', '2159']); let openedIds = ref([]); diff --git a/src/components/scaleBox/index.vue b/src/components/scaleBox/index.vue index 0e40dd8..3de5509 100644 --- a/src/components/scaleBox/index.vue +++ b/src/components/scaleBox/index.vue @@ -37,8 +37,10 @@ const getScale = () => { // 根据缩放比例调整容器的大小,确保不超出窗口的尺寸 const container = ContainerBox.value; - container.style.width = `${Math.min(width.value * scale.value, maxWidth.value)}px`; - container.style.height = `${Math.min(height.value * scale.value, maxHeight.value)}px`; + if(container) { + container.style.width = `${Math.min(width.value * scale.value, maxWidth.value)}px`; + container.style.height = `${Math.min(height.value * scale.value, maxHeight.value)}px`; + } }; const debounce = (fn: Function, delay: number = 500) => { const delays = delay || 500; diff --git a/src/views/index.vue b/src/views/index.vue index 8d80c35..ebf6807 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -1,52 +1,53 @@