动态更改颜色
async updateOptions() {
const resIsInShelf = await getQueryIsInShelf(this.bookId);
if (resIsInShelf.ok) {
if (resIsInShelf.data) {
this.options[1].text = "移出书架";
this.options[1].color = "#ffa200";
} else {
this.options[1].text = "加入书架";
this.options[1].color = "";
}
}else{
this.message("error", resIsInShelf.msg);
}
},
uni-goods-nav没有color属性,下载其vue页面,注册为组件
内部引用的是组件uni-icons
uni-icons是有color属性的,只要将uni-goods-nav的color属性传递给uni-icons即可