Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bg-ui-demos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
白舜
bg-ui-demos
Commits
bc3a2322
Commit
bc3a2322
authored
Apr 18, 2023
by
白舜
🎱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复btns2的问题
parent
0def5631
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
47 deletions
+101
-47
src/App.vue
src/App.vue
+88
-12
src/bg-ui/bg-table-btns2.vue
src/bg-ui/bg-table-btns2.vue
+10
-35
vite.config.js
vite.config.js
+3
-0
No files found.
src/App.vue
View file @
bc3a2322
...
...
@@ -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);
<cw
title=
"bg-table-btns"
/>
<cw
title=
"bg-table-pro"
/>
<cw
title=
"bg-table"
/>
<!-- <cw title="bg-tabs">
<bg-tabs>
<div>a</div>
<div>b</div>
<div>c</div>
<template #actions>
<div>a action</div>
<div>b action</div>
<div>c action</div>
</template>
</bg-tabs>
</cw> -->
<cw
title=
"bg-tabs"
>
<bg-table
ref=
"bgTable"
:headers=
"[
{
label: '名称',
prop: 'name',
minWidth: 240,
},
{
label: '操作',
prop: 'action',
width: 240,
fixed: 'right',
},
]"
:rows=
"tableRows"
:is-index=
"true"
:stripe=
"true"
>
<
template
#action
="{
row
}"
>
<bg-table-btns2
:limit=
"2"
:table-data=
"tableRows"
>
<!--
<bg-table-btn
v-for=
"(item, index) in [
{ name: 'for-1' }, { name: 'for-2' }]"
:key="index"
:disabled="row.disabled"
@click="handleTest(item.name)">
{{
item
}}
</bg-table-btn>
-->
<bg-table-btn
v-if=
"row.status === 0"
:disabled=
"row.disabled"
class=
"btn"
@
click=
"handleTest('续订')"
>
续订
</bg-table-btn>
<bg-table-btn
v-if=
"row.status === 2"
class=
"btn"
@
click=
"handleTest('再次申请')"
>
再次申请
</bg-table-btn>
<bg-table-btn
class=
"btn"
@
click=
"handleTest('审批详情')"
>
审批详情
</bg-table-btn>
<bg-table-btn
v-if=
"row.status === 3"
class=
"btn"
:disabled=
"!row.disabled"
@
click=
"handleReviewDialog(row, 'submit')"
>
评价
</bg-table-btn>
<bg-table-btn
v-else
class=
"btn"
@
click=
"handleTest('评价详情')"
>
评价详情
</bg-table-btn>
<bg-table-btn
class=
"btn"
@
click=
"handleTest('删除')"
>
删除
</bg-table-btn>
</bg-table-btns2>
</
template
>
</bg-table>
</cw>
<cw
title=
"bg-tags"
>
<bg-tags
value=
"1, 2, 3, 4"
...
...
src/bg-ui/bg-table-btns2.vue
View file @
bc3a2322
<
template
>
<div
ref=
"bgTableBtnsRef"
class=
"bg-table-btns"
>
<slot></slot>
<el-popover
:
width=
"88"
:
popper-style=
"bgTablePopover"
trigger=
"hover"
>
<el-popover
:popper-style=
"bgTablePopover"
trigger=
"hover"
>
<div
class=
"more-box"
:style=
"state.style"
>
<span
v-for=
"(item, index) in state.lastChildren"
...
...
@@ -65,12 +65,10 @@ const state = reactive({
watch
(
()
=>
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
"
,
};
...
...
vite.config.js
View file @
bc3a2322
...
...
@@ -14,6 +14,9 @@ export default defineConfig({
"
@
"
:
resolve_path
(
"
src
"
),
},
},
build
:
{
sourcemap
:
true
,
},
server
:
{
port
:
3001
,
proxy
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment