我需要重写 这段代码
export default Vue.extend<Props>({
  functional: true,
  render(h, { props, slots, data }) {
    const { href, external, target, type, button } = props;
    const slot = slots().default;
    console.log(data);
    ....
到 Vue 3 组合脚本设置, 所以我设法得到了
<script setup lang="ts">
 import {h, useSlots} from 'vue';
 const props = defineProps<Props>();
 const slots = useSlots();
 ...
但是我如何获取数据? 从这部分开始 -> render(h, { props, slot, data }) {
数据应该包含 domProps 如果有这样的..等
console.log(数据);
{
    {                                                                                                                                                                                                                                   
  attrs: {
    target: '_self',
    href: 'https://example.com',
    button: true
  },
  class: [
    'X-button',
    {
      'X-button--': false,
      'X-button--size-auto': true
    }
  ]
}
提前致谢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
如果您仍然需要这个,
useSlots().default()返回槽的数据,包括 DOM 属性。