Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: tree drop single select #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ChuChencheng merged 2 commits into dev from fix/55
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/App.vue
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default defineComponent({

button {
cursor: pointer;
width: 100px;
min-width: 100px;
height: 38px;
margin-right: 30px;
margin-bottom: 10px;
Expand Down
20 changes: 19 additions & 1 deletion examples/Drop.vue
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div style="padding: 10px;">
<div style="width: 200px">
<p>自定义展示 slot :</p>
<VTreeDrop
Expand Down Expand Up @@ -40,6 +40,22 @@
</VTreeDrop>
{{ value }}
</div>
<div style="width: 200px">
<p>单选:</p>
<VTreeDrop
v-model="value2"
:data="data"
selectable
clearable
drop-placeholder="请选择"
:placement="placement"
:dropdown-min-width="300"
dropdown-width-fixed
>
<template #empty>slot 传进来的暂无数据</template>
</VTreeDrop>
选中的值:{{ value2 }}
</div>
</div>
</template>

Expand Down Expand Up @@ -72,13 +88,15 @@ export default defineComponent({
setup() {
const data = ref(genData().data)
const value = ref('2')
const value2 = ref('2')
const placement = ref<PlacementType>('bottom-start')
function handleCheckedChange() {
console.log('checked-change')
}
return {
data,
value,
value2,
placement,
handleCheckedChange
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/TreeDrop.vue
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ export default defineComponent({
node?: TreeNode,
key?: TreeNodeKeyType
): void {
debugger
slotProps.selectedNode = node
slotProps.selectedKey = key

if (node) {
const titleField = treeSearchRef.value.$refs.treeRef.value.titleField
const titleField = treeSearchRef.value.$refs.treeRef.titleField
selectedTitle.value = node[titleField]
} else if (key) {
selectedTitle.value = key as string
Expand All @@ -417,7 +416,7 @@ export default defineComponent({
props.modelValue as TreeNodeKeyType
)
if (node) {
const titleField = treeRef.value.titleField
const titleField = treeRef.titleField
selectedTitle.value = node[titleField]
} else {
selectedTitle.value = props.modelValue as any
Expand Down

AltStyle によって変換されたページ (->オリジナル) /