Web Component中使用slot

  • Web Component中使用slot的使用方式与vue中slot很像,或许后者借用了前者的思想。
  • Web Component支持具名slot和默认slot,见下例:


    Web Component中使用slot_第1张图片




shadowDom 示例




    
我是slot1
我是slot2
我是默认slot

你可能感兴趣的:(Web Component中使用slot)