opentiny / tiny-vue

TinyVue is an enterprise-class UI component library of OpenTiny community, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
https://opentiny.design/tiny-vue
MIT License
1.58k stars 254 forks source link

🐛 [Bug]: 手动改变Collapse组件的modelValue的时候,change事件不会触发 #1294

Open AcWrong02 opened 8 months ago

AcWrong02 commented 8 months ago

Version

latest

Vue Version

latest

Link to minimal reproduction

<template>
  <tiny-collapse class="demo-collapse-wrap" v-model="activeNames" @change="change">
    <tiny-collapse-item title="一致性 Consistency" :name="1">
      <div>与现实生活一致:与现实生活的流程、逻辑保持一致,遵循用户习惯的语言和概念;</div>
      <div>在界面中一致:所有的元素和结构需保持一致,比如:设计样式、图标和文本、元素的位置等。</div>
    </tiny-collapse-item>
    <tiny-collapse-item title="反馈 Feedback" :name="2">
      <div>控制反馈:通过界面样式和交互动效让用户可以清晰的感知自己的操作;</div>
      <div>页面反馈:操作后,通过页面元素的变化清晰地展现当前状态。</div>
    </tiny-collapse-item>
    <tiny-collapse-item title="效率 Efficiency" :name="3">
      <div>简化流程:设计简洁直观的操作流程;</div>
      <div>清晰明确:语言表达清晰且表意明确,让用户快速理解进而作出决策;</div>
      <div>帮助用户识别:界面简单直白,让用户快速识别而非回忆,减少用户记忆负担。</div>
    </tiny-collapse-item>
    <tiny-collapse-item title="可控 Controllability" :name="4">
      <div>用户决策:根据场景可给予用户操作建议或安全提示,但不能代替用户进行决策;</div>
      <div>结果可控:用户可以自由的进行操作,包括撤销、回退和终止当前操作等。</div>
    </tiny-collapse-item>
  </tiny-collapse>
  <button @click="click">
    click
  </button>
</template>

<script setup>
import { ref } from 'vue'
import { Collapse as TinyCollapse, CollapseItem as TinyCollapseItem, Modal } from '@opentiny/vue'

const activeNames = ref([1, 3])
const click = ()=>{
  activeNames.value = [1,2,3]
}
function change(activeNames) {
  Modal.message({
    message: 'change 事件,当前激活面板:' + activeNames,
    status: 'info'
  })
}
</script>

<style scoped lang="less">
.demo-collapse-wrap {
  .tiny-collapse-item__content > * {
    line-height: 1.8;
  }
}
</style>

Step to reproduce

演练场的链接分享好像有问题,所以只贴了代码。 点击click按钮

What is expected

点击click按钮,希望触发change事件

What is actually happening

点击click按钮,没触发change事件

Any additional comments (optional)

No response

Issues-translate-bot commented 8 months ago

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: When manually changing the modelValue of the Collapse component, the change event will not be triggered.

wkif commented 8 months ago

尝试修复 1308

shenjunjian commented 2 months ago

该问题类似于 issue #1298 , change事件是在通过操作组件才产生的事件, 通过脚本去修改值,不应该触发change事件

非问题,不需要修复

Issues-translate-bot commented 2 months ago

Bot detected the issue body's language is not English, translate it automatically.


This issue is similar to issue #1298, The change event is an event that is generated by operating the component. If the value is modified through a script, the change event should not be triggered.

Not a problem, no need to fix