当前位置:网站首页>Custom components -- slots
Custom components -- slots
2022-07-28 06:56:00 【Like Feynman%】
1. In the custom component of wxml In structure , Can provide a <slot> node ( slot ), Used to host component users wxml structure
1.2 In the applet , By default, only one is allowed in each custom component <slot> To carry on the placeholder , such Limit on the number It's called a single slot
// The encapsulator of the component
<text>components/test_1/test2.wxml</text>
<view>
<slot></slot>
</view>
// Users of components
<test2>//test2 Insert components in the label slot The content in
<button size="mini"> Click on </button>
</test2>1.3 Enable multiple slots
In the custom component of the applet , Need to use <slot> Slot time , It can be found in the component's js Enabled in file
Component({
options:{
multipleSlots:true// Enable multiple in the options of component definition slots Support
},
})1.4 Define multiple slots
Can be found in the .wxml Using multiple in <slot> label , In different ways name To distinguish between different slots .
<view>
<slot name="before"></slot>
<view> This is the dividing line ——————————————————******</view>
<slot name="after"></slot>
</view>1.5 Use multiple slots
In the use of Custom components with multiple slots when , Need to use slot attribute To insert nodes into different <slot> in
<test2>
<button size="mini" slot="before"> Click on </button>
<input type="text" slot="after" style="background-color:rgb(112, 211, 211);"/>
</test2>
边栏推荐
- Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking
- Build php7 private warehouse
- 遍历 二叉树
- Ten thousand words summarize and realize the commonly used sorting and performance comparison
- JS reverse question 100 - question 1
- Centos7 deploy MySQL database server
- cocos2d-x 学习笔记——瓦片地图TiledMap
- Qgraphicsview promoted to qchartview
- Technology sharing | sending requests using curl
- MySQL主从
猜你喜欢

单元测试框架Jest搭配TypeScript的安装与配置

Ten thousand words summarize and realize the commonly used sorting and performance comparison

shell脚本——“三剑客”之awk命令

prometheus监控nacos

KVM hot migration

Archery database audit platform deployment

Shell script - regular expression

Which is the best air conduction Bluetooth headset? Air conduction Bluetooth headset ranking

Method of designing test cases

Dynamic memory management function of C language
随机推荐
C language memcpy library functions and the role of memmove
TCP/IP五层模型
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
软件测试的生命周期(流程)
Ubuntu18.04+Centos7配置redis主从【学习笔记】
Si Han talks about the professional development of testers
网络——数据链路层
防火墙——iptables防火墙(四表五链、防火墙配置方法、匹配规则详解)
测试面试题集锦(一)| 软件测试常见必考问题与流程篇(附答案)
Insertion and deletion of nodes in linked list
单元测试框架Jest搭配TypeScript的安装与配置
KVM热迁移
Technology sharing | how to simulate real use scenarios? Mock technology to help you
KVM hot migration
Ubuntu18.04搭建redis集群【学习笔记】
ISO 3.0-server three power separation configuration
raid磁盘阵列
测试面试题集锦(二)| 测试工具篇(附答案)
PKU-2739-Sum of Consecutive Prime Numbers(筛素数法打表)
Which is the best one to make air conduction headphones? Inventory of the best air conduction headphones