Skip to content
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

fix(comp:tree-select): cannot get node through getNode #1121

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

liuzaijiang
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

<template>
  <IxForm class="demo-form" :control="formGroup">
    <IxFormItem>
      <ix-tree-select
        style="width: 300px"
        v-bind="bindData"
        control="treeSelect"
        :dataSource="dataSouce"
        ref="treeSelectRef"
      >
        <template #expandIcon="{ expanded }">
          <ix-icon :name="expanded ? 'minus-square' : 'plus-square'" />
        </template>
      </ix-tree-select>
    </IxFormItem>
    <IxButton mode="primary" @click="onSubmit">Submit</IxButton>
  </IxForm>
</template>

<script setup lang="ts">
import { Validators, useFormGroup } from '@idux-vue2/cdk/forms'
import { ref } from '@idux-vue2/cdk/vue'

const { required } = Validators

const bindData = ref({
  multiple: true,
  showLine: true,
  cascade: true,
  checkable: true,
  searchable: 'overlay',
  labelKey: 'label',
  getKey: 'value',
  checkStrategy: 'parent',
})
const formGroup = useFormGroup({
  treeSelect: [['测试3'], [required]],
})
const treeSelectRef = ref(null)
const onSubmit = () => {
  const item = treeSelectRef.value.getNode('测试3')
  console.log(treeSelectRef.value)
  console.log(item)
}
const dataSouce = ref([
  {
    label: '测试1',
    value: '测试3',
    view: '1',
  },
  {
    label: '测试2',
    value: '测试4',
    view: '2',
  },
])
</script>

<style lang="less" scoped>
.demo-form {
  max-width: 300px;
  font-size: 12px;
}
.text-right {
  text-align: right;
}
</style>

下拉框浮层没有渲染时,无法通过getNode获取到node

What is the new behavior?

可以获取到

Other information

@idux-bot
Copy link

idux-bot bot commented Sep 7, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Sep 7, 2022

Codecov Report

Merging #1121 (ddb60d2) into main (ed08884) will decrease coverage by 0.12%.
The diff coverage is 100.00%.

❗ Current head ddb60d2 differs from pull request most recent head cdea3a3. Consider uploading reports for the commit cdea3a3 to get more accurate results

@@            Coverage Diff             @@
##             main    #1121      +/-   ##
==========================================
- Coverage   96.92%   96.79%   -0.13%     
==========================================
  Files         321      321              
  Lines       30624    30775     +151     
  Branches     2806     2800       -6     
==========================================
+ Hits        29682    29790     +108     
- Misses        942      985      +43     
Impacted Files Coverage Δ
packages/cdk/portal/src/Portal.tsx 100.00% <100.00%> (ø)
packages/cdk/utils/src/vNode.ts 95.40% <100.00%> (-0.30%) ⬇️
...ckages/components/_private/overlay/src/Overlay.tsx 100.00% <100.00%> (ø)
packages/components/_private/overlay/src/types.ts 100.00% <100.00%> (ø)
packages/components/cascader/src/Cascader.tsx 100.00% <100.00%> (ø)
packages/components/config/src/defaultConfig.ts 100.00% <100.00%> (ø)
packages/components/config/src/types.ts 100.00% <100.00%> (ø)
packages/components/drawer/src/Drawer.tsx 100.00% <100.00%> (ø)
packages/components/drawer/src/types.ts 100.00% <100.00%> (ø)
packages/components/dropdown/src/Dropdown.tsx 100.00% <100.00%> (ø)
... and 21 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@danranVm danranVm merged commit ab22a93 into IDuxFE:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants