web前端全系列 教程
1839个小节阅读:2244.2k
鸿蒙应用开发
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
商品加入购物车,立即购买
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
options | Array | - | 组件参数 |
buttonGroup | Array | - | 组件按钮组参数 |
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
text | String | - | 显示文字 |
icon | String | 图标,参考 | |
info | Number | 0 | 右上角数字角标 |
infoBackgroundColor | String | #ff0000 | 角标背景色 |
infoColor | String | #fff | 角标前景色 |
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
text | String | - | 按钮文字 |
backgroundColor | String | - | 按钮背景色 |
color | String | - | 字体颜色 |
事件名 | 说明 | 返回值 |
---|---|---|
@click | 左侧点击事件 | e = {index,content} |
@buttonClick | 右侧按钮组点击事件 | e = {index,content} |
xxxxxxxxxx
<uni-goods-nav
:options="options"
:buttonGroup="buttonGroup"
@click="onClick"
@buttonClick="buttonClick"
/>
xxxxxxxxxx
export default {
data() {
return {
options: [
{
icon: 'headphones',
text: '客服'
},
{
icon: 'shop',
text: '店铺',
info: 2,
infoBackgroundColor:'#007aff',
infoColor:"red"
},
{
icon: 'cart',
text: '购物车',
info: 2
},
],
buttonGroup: [
{
text: '加入购物车',
backgroundColor: '#ff0000',
color: '#fff'
},
{
text: '立即购买',
backgroundColor: '#ffa200',
color: '#fff'
}
]
}
},
methods: {
onClick (e) {
uni.showToast({
title: `点击${e.content.text}`,
icon: 'none'
})
},
buttonClick (e) {
console.log(e)
this.options[2].info++
}
}
}
实时效果反馈
1. uni-ui中,使用商品导航组件,哪个属性可以配置组件按钮:
A options
B text
C info
D buttonGroup
答案
1=>D