1、自定義組件定義slot的name屬性
book.wxml
~~~
<text class="content tag-class">{{content}} <slot name="after"></slot></text>
~~~
2、自定義組件注冊使得能夠使用slot和自定義class
book.js
~~~
Component({
/**
* 組件的屬性列表
*/
properties: {
content: String
},
options:{
multipleSlots:true
},
externalClasses:['tag-class']
}
~~~
3、在父組件使用組件時給其添加wxml
~~~
<v-book content="{{content}}" tag-class="{{index==0?'bg1':''||index==1?'bg2':''}}">
<text slot="after">+{{numbers}}</text>
</v-book>
~~~
- 小程序環境配置
- 1.生命周期
- 頁面生命周期
- 組件生命周期
- 2.小程序組件
- 點擊事件bindtap|catchtap
- swiper輪播
- wx:for循環
- 播放音樂
- map
- tabBar底部頁面切換
- scroll-view可滾動視圖區域。
- web-view裝載顯示網頁
- priviewImage新頁面預覽照片
- chooseImage本地選擇照片
- onReachBottom上拉刷新,加載等待條
- setStorage緩存
- showToast彈出提示框
- slot父組件wxml傳遞到子組件
- form表單
- 小程序.wxs,方法在.wxml調用
- 3.組件前身:模板、模板傳參
- 4.自定義組件、組件傳參|傳wxss|wxml代碼
- 5.小程序正則
- 6.小程序頁面跳轉
- 7.open-type 微信開放功能
- 實例
- 1.第一個實例 hello world
- 2.第二個實例豆瓣電影數據渲染
- 豆瓣1.0基本版
- 豆瓣2.0升級版
- 豆瓣3.0豪華版
- 3.第三個實例多接口在同一頁面使用
- HTTP封裝
- 基礎報錯提示,類式封裝
- Promise回調,類式封裝