vue 具名 插槽

// 子组件 Dialog
<template>
  <div class="content">
      <!-- 插槽 自定义名: payment -->
      <slot name = 'payment'></slot>
  </div>
</template>

<!-- 插槽 -->
<template>
   <Dialog>
   	 <!-- 插槽 自定义名: payment -->
     <template #payment>
     	<p>11111</p>
     </template>
   </Dialog>
</template>

// 父页面
<script>
// 引入子组件
import Dialog from '@/components/dialog.vue'
export default {
  components: {
    Dialog
  },
}
</script>

你可能感兴趣的:(vue,vue.js,前端,javascript)