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

OMI接收不了Vue传过来的方法 #942

Open
WaterAndBin opened this issue Jan 15, 2025 · 1 comment
Open

OMI接收不了Vue传过来的方法 #942

WaterAndBin opened this issue Jan 15, 2025 · 1 comment

Comments

@WaterAndBin
Copy link

这是在OMI的代码

import { h, tag, Component } from 'omi';
@tag('y-switch')
export default class YSwitch extends Component {
  static props = {
    beforeChange: {
      type: Function,
      default: null,
      changed(newValue: Function) {
        console.log(12312313);
        console.log(newValue);

        if (this instanceof YSwitch) {
          this.update();
        }
      }
    }
  };
  render(props: any) {
    console.log(props);
    return <div>hallo,omi</div>;
  }
}

这是在Vue的代码

<script setup lang="ts">
import { ref } from 'vue'

const changeLoading = async () => {
  await new Promise((resolve) => setTimeout(resolve, 1000))
  return true
}
</script>

<template>
  <div>
    <div className="flex justify-center items-center">
      <y-switch :before-change="changeLoading"></y-switch>
      <y-switch :beforeChange="changeLoading"></y-switch>
    </div>
  </div>
</template>

获取到的beforeChange都是undefeind/null,请问一下这个情况要如何解决?非常感谢

@dntzhang
Copy link
Collaborator

触发不了dom的 setAttribute 就传不下去

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

No branches or pull requests

2 participants