feat:练字贴功能基本完成
This commit is contained in:
@@ -10,6 +10,10 @@ Component({
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
cardList: {
|
||||
type: Array,
|
||||
value: [],
|
||||
},
|
||||
currentTab: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
@@ -31,14 +35,20 @@ Component({
|
||||
},
|
||||
lifetimes: {
|
||||
ready() {
|
||||
// 初始化同步一次 selectedWords,避免首次传入时未触发 observers 的情况
|
||||
const list = (this.data as any).cardList || [];
|
||||
if (Array.isArray(list) && list.length > 0) {
|
||||
const selectedWords = list.map((item: any) => item.word);
|
||||
this.setData({ selectedWords });
|
||||
}
|
||||
},
|
||||
},
|
||||
/* observers: {
|
||||
observers: {
|
||||
cardList(newVal: CardList) {
|
||||
const selectedWords = newVal.map((item) => item.word);
|
||||
this.setData({ selectedWords });
|
||||
},
|
||||
}, */
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
wx:for="{{wordList}}"
|
||||
wx:for-index="categoryIndex"
|
||||
wx:key="categoryIndex"
|
||||
title="{{wordList[categoryIndex].categoryName}}">
|
||||
title="{{wordList[categoryIndex].icon}} {{wordList[categoryIndex].categoryName}}">
|
||||
<view class="word-list-wrapper">
|
||||
<view class="word-list">
|
||||
<view
|
||||
|
||||
Reference in New Issue
Block a user