Tencent / tdesign-vue-next

A Vue3.x UI components lib for TDesign.
https://tdesign.tencent.com/vue-next
MIT License
1.46k stars 471 forks source link

[Tree] Tree Events - active 事件中,参数 context 中 actived 值和实际状态相反 #3110

Open sertceps opened 1 year ago

sertceps commented 1 year ago

tdesign-vue-next 版本

1.3.11

重现链接

https://codesandbox.io/p/sandbox/weathered-forest-q65575

重现步骤

  1. vue3 框架 && typescript && vite
  2. 自动导入插件
  3. 单页面,script setup 语法
  4. 如下代码
    
    <script setup lang="ts">
    import { TreeOptionData, TreeNodeValue } from 'tdesign-vue-next'
    import { computed, ref, reactive } from 'vue'
    import { getTreeDataApi } from './api'
    import { genTreeOptions } from '@/apis/utils/data'

interface Props { modelValue?: boolean }

const props = withDefaults(defineProps(), { modelValue: false, })

interface Emits { (e: 'active', v?: number): void }

const emits = defineEmits()

const treeList = ref<TreeOptionData[]>([]) async function fetchData() { treeList.value = await getTreeDataApi() }

fetchData()

const result = ref({ value: [], actived: false, })

function clickHandler(v: TreeNodeValue[], ctx) { result.value.value = v result.value.actived = ctx.node.actived }

defineExpose({ refresh: fetchData, })

const resultShow = computed(() => JSON.stringify(result.value))



### 期望结果

点击节点进行激活时,context.node.actived 为 true。

### 实际结果

点击节点激活时,context.node.actived 为 false,再次点击取消激活时为 true。

### 框架版本

_No response_

### 浏览器版本

_No response_

### 系统版本

Windows 11 家庭版 22621.1992

### Node版本

v18.16.1

### 补充说明

我想知道这是 Bug 还是有意设计,如果是有意设计,那么适用场景是什么?
github-actions[bot] commented 1 year ago

👋 @sertceps,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

github-actions[bot] commented 1 year ago

♥️ 有劳 @LeeJim @pengYYYYY 尽快确认问题。 确认有效后将下一步计划和可能需要的时间回复给 @sertceps 。

sertceps commented 1 year ago

补充说明(本地):

  1. vue 版本:3.3.4
  2. vite 版本:4.4.3
  3. 浏览器版本:Chrome 114.0.5735.199
  4. 其它依赖:
    
    "dependencies": {
    "@vueuse/core": "^10.2.1",
    "axios": "^1.4.0",
    "echarts": "^5.4.2",
    "lodash": "^4.17.21",
    "nprogress": "^0.2.0",
    "pinia": "^2.1.4",
    "pinia-plugin-persistedstate": "^3.1.0",
    "qs": "^6.11.2",
    "tdesign-vue-next": "^1.3.11",
    "tvision-color": "^1.6.0",
    "vue": "^3.3.4",
    "vue-router": "^4.2.4"
    },
    "devDependencies": {
    "@types/nprogress": "^0.2.0",
    "@types/lodash": "^4.14.195",
    "@types/qs": "^6.9.7",
    "@typescript-eslint/eslint-plugin": "^5.61.0",
    "@typescript-eslint/parser": "^5.61.0",
    "@vitejs/plugin-vue": "^4.2.3",
    "@vitejs/plugin-vue-jsx": "^3.0.1",
    "@vue/eslint-config-typescript": "^11.0.3",
    "cz-conventional-changelog": "^3.3.0",
    "eslint": "^8.44.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-vue": "^9.15.1",
    "husky": "^8.0.3",
    "lint-staged": "^13.2.3",
    "postcss": "^8.4.25",
    "postcss-html": "^1.5.0",
    "postcss-scss": "^4.0.6",
    "prettier": "^2.8.8",
    "sass": "^1.63.6",
    "stylelint": "^15.10.1",
    "stylelint-config-standard-scss": "^10.0.0",
    "stylelint-order": "^6.0.3",
    "stylelint-prettier": "^3.0.0",
    "typescript": "^5.1.6",
    "unplugin-auto-import": "^0.16.6",
    "unplugin-vue-components": "^0.25.1",
    "vite": "^4.4.3",
    "vite-plugin-html": "^3.2.0",
    "vite-svg-loader": "^4.0.0",
    "vue-tsc": "^1.8.5"
    }
gaoachao commented 1 year ago

感觉像是bug,正在处理。