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

[Bug Report]Table组件,renderHeader方法,里面渲染的Input组件上所有事件全都不触发 #394

Open
zhangzhenchang opened this issue Nov 2, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@zhangzhenchang
Copy link

       {
          title: '查看关联案件',
          key: "operate",
          renderHeader: (h, params) => {
            return h('div', [
              h('Input', {
                class: "right_item",
                style: {
                  width: 'auto'
                },
                  on: {
                    search: ()=> {
                      console.log("查看案件")
                    },
                    click: ()=> {
                      console.log("查看案件9999")
                    },
                    change: ()=>{
                      console.log("查看案件9999--change")
                    },
                    blur: ()=>{
                      console.log("查看案件9999--blur")
                    },
                  },
                props: {
                  placeholder: "请搜索要素关键词",
                  suffix: "ios-search",
                  search: true,
                },

              }, "自定义表头")
            ]);
          },

        }

on 上面绑定的所有事件全都不触发,改成Button是可以的

@zhangzhenchang zhangzhenchang changed the title Table组件,renderHeader方法,里面渲染的Input组件上所有事件全都不触发 [Bug Report]Table组件,renderHeader方法,里面渲染的Input组件上所有事件全都不触发 Nov 2, 2024
Copy link

dosubot bot commented Nov 2, 2024

Hey @zhangzhenchang! 👋 I'm here to help you with your coding conundrum. I'm a bot that can assist with bugs, questions, and more while you wait for a human maintainer.

The issue you're experiencing with the Input component's events not triggering in the renderHeader method might be related to how Vue handles event binding in custom render functions. Here are a few things you can try to resolve the issue:

  1. Ensure Correct Event Binding: Make sure that the event names are correctly specified. For Vue 3, the event names should be in camelCase, so ensure that the event names like onSearch, onClick, onChange, and onBlur are used instead of search, click, change, and blur.

  2. Check Component Registration: Ensure that the Input component is correctly registered in your Vue instance or component. If it's a global component, it should be available automatically, but if it's a local component, make sure it's imported and registered properly.

  3. Verify Event Propagation: Sometimes, event propagation might be stopped by parent elements. Ensure that there are no stopPropagation or similar methods being called on parent elements that might prevent the events from reaching the Input component.

  4. Debugging: Add some console logs or breakpoints to check if the renderHeader function is being called as expected and if the Input component is being rendered correctly.

If these steps do not resolve the issue, it might be helpful to compare the implementation with the Button component, which works as expected, to identify any differences in how events are handled.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the Bug Something isn't working label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant