diff --git a/src/App.vue b/src/App.vue index cdc9df6ce6ad1cdf6a7768c5943df78bf3363521..e0a6484e17799df1080f6e31318d5660bed1ce9e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -47,6 +47,33 @@ const detailTable = reactive({ }, }); +const tableRows = [ + { + name: "hello whidy", + disabled: true, + status: 0, + }, + { + name: "hello bg", + disabled: false, + status: 1, + }, + { + name: "hello bg", + disabled: true, + status: 2, + }, + { + name: "hello bg", + disabled: false, + status: 3, + }, +]; + +const handleTest = (val) => { + alert(val); +}; + const info = reactive({ // data in template would couse volar error: // [Error - 14:18:50] Request textDocument/formatting failed. @@ -195,18 +222,67 @@ const { title: cardTitle, icon: cardIcon } = toRefs(card); - + + + + +
- +
props.tableData, () => { - setTimeout(() => { - nextTick(() => { - calcTabs(); - dealData(); - }); - }, 1000); + nextTick(() => { + calcTabs(); + dealData(); + }); }, { deep: true, @@ -90,13 +88,13 @@ const calcTabs = () => { state.lastChildren = []; tabSlots.forEach((e) => { //注释和v-if忽略 - if (e.type.toString() == "Symbol(Comment)") { + if (Object.prototype.toString.call(e.children) == "[object String]") { //v-for 再次遍历 - } else if (e.type.toString() == "Symbol(Fragment)") { + } else if (Object.prototype.toString.call(e.children) == "[object Array]") { let children = e.children || []; children.forEach((el) => { //注释和v-if忽略 - if (el.type.toString() == "Symbol(Comment)") { + if (Object.prototype.toString.call(e.children) == "[object String]") { console.log(el.type); } else { tempSlots.push(el); @@ -120,30 +118,6 @@ const calcTabs = () => { } }; -const showMoreBtns = () => { - calcTabs(); - dealData(); - nextTick(() => { - updateSytle(); - if (state.timer) clearTimeout(state.timer); - state.showMore = true; - }); -}; -const hideMoreBtns = () => { - if (state.timer) clearTimeout(state.timer); - state.timer = setTimeout(() => { - state.showMore = false; - }, 50); -}; -const updateSytle = () => { - let { top, right } = lastEl.value.getBoundingClientRect(); - let { width } = window.document.body.getBoundingClientRect(); - state.style = { - top: `${top + 16}px`, - right: `${width - right - 16}px`, - }; -}; - const dealData = () => { let children = bgTableBtnsRef.value.children || []; state.children = children; @@ -168,7 +142,8 @@ const dealData = () => { }; const bgTablePopover = { - width: "88px", + width: "auto", + maxWidth: "96px", padding: "4px 0", minWidth: "60px", }; diff --git a/vite.config.js b/vite.config.js index e8b9c3876bf2e0fca502eccb10681de57557e561..f3854ec0b3ff8e07de34b7504e3e655a1eb83c90 100644 --- a/vite.config.js +++ b/vite.config.js @@ -14,6 +14,9 @@ export default defineConfig({ "@": resolve_path("src"), }, }, + build: { + sourcemap: true, + }, server: { port: 3001, proxy: {