美文网首页
vue3中slot使用的一些变化

vue3中slot使用的一些变化

作者: EasyNetCN | 来源:发表于2021-12-30 06:54 被阅读0次

完整实例可以参考:easymesh-ui(https://github.com/easynet-cn/easymesh-ui

在vue3中使用组件中的slot(不是在组件中定义slot),需要使用template来实现。比如在easymesh-ui中的Badge示例中,要使用Badge中的定义的count slot,那么正确的代码如下:

<template>
    <div>
        <Badge>
            <a href="#" class="demo-badge" style="margin-left: 32px"></a>
            <template v-slot:count>
                <Icon type="md-time" color="#ed4014" size="16" />
            </template>
        </Badge>
    </div>
</template>

相关文章

  • vue3中slot使用的一些变化

    完整实例可以参考:easymesh-ui(https://github.com/easynet-cn/easyme...

  • 18、Vue3 作用域插槽

    作用域插槽:让插槽内容能够访问子组件中,vue2中作用域插槽使用slot-scope,vue3中使用v-slot ...

  • vue3-slot-消息框-模态框

    1.前言 1.使用vue3 的slot插槽时,大部分和vue2-slot插槽[https://www.jiansh...

  • Vue3中的slot

    小编今天和大家一起探讨Vue中的插槽(slot)的概念,熟悉Vue的小伙伴都知道父子组件之间可以相互传递数据,但是...

  • vue template 中 slot-scope/scope

    vue template 中 slot-scope/scope 的使用在vue 2.5.0+ 中slot-scop...

  • 四。插槽,Attribute 继承

    插槽 在Vue3中,用template标签包裹要填充的内容,v-slot属性也需定义在template标签上,只有...

  • Vue3.0 组件的核心概念_插槽

    Vue 在 2.6 版本中,对插槽使用 v-slot 新语法,取代了旧语法的 slot 和 slot-scope,...

  • (四)内置组件slot

    本节知识点 slot 使用 概述 slot 是标签的内容扩展,也就是使用slot就可以在自定义组件中传递给组件的内...

  • Web Component中使用slot

    Web Component中使用slot的使用方式与vue中slot很像,或许后者借用了前者的思想。 Web Co...

  • 插槽

    插槽的基础使用,

网友评论

      本文标题:vue3中slot使用的一些变化

      本文链接:https://www.haomeiwen.com/subject/tvxiqrtx.html