uni-app动态改变class style(视图更新this.$set)
:style="{background:arr[index]}"
if(this.chooseIndex.indexOf(e.currentTarget.dataset.serviceid) >= 0){
//重点
this.$set(this.arr,e.currentTarget.dataset.serviceid,'white')
let index = this.chooseIndex.indexOf(e.currentTarget.dataset.serviceid)
this.chooseIndex.splice(index, 1);
}else{
this.chooseIndex.push(e.currentTarget.dataset.serviceid)
//重点
this.$set(this.arr,e.currentTarget.dataset.serviceid,'#18ed8d')
}
page.jsonp配置
{
"pages" : [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path" : "pages/index/index",
"style" : {
"navigationBarTitleText" : "appName"
}
},
{
"path": "pages/index/gudie",
"style": {
"navigationBarTitleText": "",
"app-plus": {
"titleNView": {
"backgroundColor":"rgba(0, 0, 0, 0)",
"type" : "transparent"
}
}
}
},
{
"path" : "pages/tabBar/home/home",
"style" : {
"navigationBarBackgroundColor" : "#5a8ded",
"navigationBarTextStyle" : "white",
"navigationBarTitleText" : "首页",
"app-plus" : {
"titleNView" : {
"buttons" : [
{
"text" : "定位中...",
"fontSize" : "14",
"select" : true,
"width" : "auto",
"float" : "left"
}
]
}
}
}
},
{
"path" : "pages/tabBar/order/order",
"style" : {
"navigationBarBackgroundColor" : "#5a8ded",
"navigationBarTextStyle" : "white",
"navigationBarTitleText" : "订单",
"enablePullDownRefresh" : true
}
},
{
"path" : "pages/tabBar/my/my",
"style" : {
"navigationBarBackgroundColor" : "#5a8ded",
"navigationBarTextStyle" : "white",
"navigationBarTitleText" : "我的",
"app-plus" : {
"bounce" : "none",
"titleNView" : {
"buttons" : [
{
// "text" : "\ue612",
// "fontSrc" : "/static/uni.ttf",
// "fontSize" : "24px",
// "color" : "#fff"
}
]
}
}
}
},
{
"path" : "pages/addressList/addressList",
"style" : {
"navigationBarTitleText" : "我的地址",
"enablePullDownRefresh" : true,
"app-plus" : {
"titleNView" : {
"buttons" : [
{
"text" : "\ue468",
"fontSrc" : "/static/uni.ttf",
"fontSize" : "30px",
"color" : "#666"
}
]
}
}
}
},
{
"path" : "pages/about/about",
"style" : {
"navigationBarTitleText" : "关于叮咚",
"backgroundColor" : "#fff",
"app-plus" : {
"bounce" : "none", //关闭窗口回弹效果
"titleNView" : {
"type" : "transparent",
"titleColor" : "#fff"
}
}
}
},
{
"path" : "pages/userInfo/userInfo",
"style" : {
"navigationBarTitleText" : "个人信息",
"app-plus" : {
"bounce" : "none",
"titleNView" : {
"buttons" : [
{
"text" : "完成",
"fontSize" : "14px",
"color" : "#fff"
}
]
}
}
}
},
{
"path" : "pages/agentQrcode/agentQrcode",
"style" : {
"navigationStyle" : "custom",
"navigationBarTitleText" : "我的二维码"
}
},
{
"path" : "pages/recommended/recommended",
"style" : {
// "navigationBarTitleText" : "家修想轻松,就要找叮咚",
// "navigationStyle":"custom",
"navigationBarTitleText" : "我们的维修",
"navigationBarBackgroundColor":"#5A8DED",
"navigationBarTextStyle":"white",
"app-plus": {
"titleNView": {
"type": "transparent"
}
}
}
},{
// addAdressCard
"path" : "pages/addAdressCard/addAdressCard",
"style" : {
}
}
,{
//澳门支付
"path" : "pages/aomenPay/index",
"style" : {
"navigationBarTitleText" : "支付",
"app-plus":{
"titleNView":{
}
}
}
}
],
"globalStyle" : {
"navigationStyle" : "default",
"navigationBarBackgroundColor" : "#FFFFFF",
"navigationBarTextStyle" : "black"
},
"tabBar" : {
"color" : "#999999",
"selectedColor" : "#5192EB",
"borderStyle" : "white",
"backgroundColor" : "#FFFFFF",
"list" : [
{
"pagePath" : "pages/tabBar/home/home",
"iconPath" : "static/tabBar/home3x.png",
"selectedIconPath" : "static/tabBar/homeSelect.png",
"text" : "首页"
},
{
"pagePath" : "pages/tabBar/order/order",
"iconPath" : "static/tabBar/order3x.png",
"selectedIconPath" : "static/tabBar/orderSelect.png",
"text" : "订单"
},
{
"pagePath" : "pages/tabBar/my/my",
"iconPath" : "static/tabBar/mine.png",
"selectedIconPath" : "static/tabBar/mind3x.png",
"text" : "我的"
}
]
}
// ,
// "condition" : {
// //模式配置,仅开发期间生效
// "current" : 3, //当前激活的模式(list 的索引项)
// "list" : [
// {
// "name" : "swiper", //模式名称
// "path" : "pages/tabBar/my/my", //启动页面,必选
// "query" : "interval=4000&autoplay=false" //启动参数,在页面的onLoad函数里面得到。
// }
// ]
// }
}