首页 > 其他分享 >vue-test4 -----插槽

vue-test4 -----插槽

时间:2023-11-08 22:34:16浏览次数:38  
标签:vue test4 插槽 ----- components SlotDemo import Main


<template>
  <!--
  <Main class="cccc"/>
  <component-a/>
  -->
  <slot-demo>
    <template #header="slotProps">
      <p>插槽标题-{{slotProps.msg}}</p>
    </template>
    <template v-slot:low>
      <p>插槽内容</p>
    </template>
  </slot-demo>
</template>
<script>
import Main from "@/components/Main.vue";
import ComponentA from "@/components/ComponentA.vue";
import SlotDemo from "@/components/SlotDemo.vue";
export default {
  components: {SlotDemo, ComponentA, Main}
}
</script>
<style>

</style>
<template>
  <slot name="header" :msg="msg"></slot>
  <slot name="low"></slot>
<h3>插槽基础知识</h3>

</template>

<script>
export default {
  name: "SlotDemo",
  data(){
    return{
      msg:"子组件元素"
    }
  }
}
</script>

<style scoped>

</style>

标签:vue,test4,插槽,-----,components,SlotDemo,import,Main
From: https://www.cnblogs.com/lin513/p/17818507.html

相关文章

  • vue-test4 -------组件之间的数据传递
    <template><h3>CompA</h3><component-b:onfun="dateFun"></component-b><p>{{msg}}</p></template><script>importComponentBfrom"@/components/ComponentB.vue";exportdefault{......
  • openGauss学习笔记-118 openGauss 数据库管理-设置数据库审计-维护审计日志
    openGauss学习笔记-118openGauss数据库管理-设置数据库审计-维护审计日志118.1前提条件用户必须拥有审计权限。118.2背景信息与审计日志相关的配置参数及其含义请参见表1。表1审计日志相关配置参数配置项含义默认值audit_directory审计文件的存储目录。/......
  • vue broadcast和dispatch
    functionbroadcast(componentName,eventName,params){this.$children.forEach((child)=>{constname=child.$options.componentName;if(name===componentName){child.$emit(...[eventName].concat(params));}else{broadcast.appl......
  • 我的世界1.20.1模组开发---7.添加物品(进阶版)
    介绍  前面我们已经介绍过了如何添加我们mod的物品,单那些物品都只是一些用于合成的物品。例如我们的各种矿石、建筑方块等,这些物品只能用于合成或者装饰,这次我们就来添加一个具有实际功能的物品,比如一些模组里的魔法杖或者武器之类的。这些物品通过按下指定的按键会有其他的功......
  • D - ABC Puzzle -- ATCODER ABC 326
    D-ABCPuzzlehttps://atcoder.jp/contests/abc326/tasks/abc326_dSampleInput1Copy5ABCBCACAABSampleOutput1CopyYesAC..B.BA.CC.BA.BA.C...CBA思路充分利用约束条件,构造算法,避免穷举所有情况,然后再根据约束条件判断情况的合法性。 如下代码,优......
  • vue2+antd 使用select 通过v-model 无法回显也不能修改?
    <template><a-tablesize="middle":data-source="dataList":pagination="false":locale="{emptyText:'暂无数据'}":scroll="{x:'max-content'}"><a-table-columntitle=......
  • 无涯教程-批处理 - Right String函数
    这用于从字符串末尾提取字符。RightString-示例@echooffsetstr=Thismessageneedschanged.echo%str%setstr=%str:~-8%echo%str%关于上述程序,需要注意的关键是,使用〜-"要提取的字符数"运算符来提取字符串的右边。上面的命令产生以下输出。Thismessagene......
  • [论文阅读] [SAGAN] Self-Attention Generative Adversarial Networks
    Self-AttentionGenerativeAdversarialNetworks(mlr.press)ZhangH,GoodfellowI,MetaxasD,etal.Self-attentiongenerativeadversarialnetworks[C]//Internationalconferenceonmachinelearning.PMLR,2019:7354-7363.引用:4501原作者代码:brain-research/self-......
  • Silt Dam--An Engineering Measure to Soil Erosion
    Whatissiltdam?Siltdam,referstothesoilerosionareaatalllevelsofditchesbuilttostopthemud,siltforthepurposeofsoilandwaterconservationengineeringmeasures. Howdoesitwork?SpecificpracticeisintheLoessPlateauregionoft......
  • 无涯教程-批处理 - Replace a String函数
    要将子字符串替换为另一个字符串,请使用字符串替换功能。ReplaceaString-示例@echooffsetstr=Thismessageneedschanged.echo%str%setstr=%str:needs=has%echo%str%关于上述程序,需要注意的关键是,该示例通过语句%str:needs=has%用字符串"has"替换了"needs"......