一、page.json配置
1、配置导航栏
"style": {
"app-plus":{
"titleNView":{
//搜索框配置
"searchInput":{
"align":"center",
"backgroundColor":"#f7f7f7",
"borderRadius":"4px",
"disabled":true,
"placeholder":"搜索",
"placeholderColor":"#cccccc"
},
"buttons":[
{
"color":"#000000",
"colorPressed":"#FFDF34",
"float":"right",
"fontSize":"24px",
"fontSrc":"/static/iconfont.ttf",
"text":"\ue604"
},{
"color":"#ff7e00",
"colorPressed":"#FFDF34",
"float":"left",
"fontSize":"24px",
"fontSrc":"/static/iconfont.ttf",
"text":"\ue606"
}
]
}
}
}
二、图文列表样式
{{item.username}}
+关注
×
{{item.title}}
{{item.support.support_count}}
{{item.support.unsupport_count}}
{{item.comment_count}}
{{item.share_num}}
export default {
data() {
return {
dynlist:[
{
username:"唐三",
userpic:"../../static/userpic/14.jpg",
isFollow:false,
title:"走出去,你才发现你跟别人差的不是一点半点",
titlepic:"../../static/datapic/18.jpg",
support:{
type:"support",
support_count:1,
unsupport_count:2
},
comment_count:4,
share_num:3
},
{
username:"小舞",
userpic:"../../static/userpic/10.jpg",
isFollow:false,
title:"走出去,你才发现你跟别人差的不是一点半点",
titlepic:"../../static/datapic/19.jpg",
support:{
type:"support",
support_count:1,
unsupport_count:2
},
comment_count:4,
share_num:3
},{
username:"戴沐白",
userpic:"../../static/userpic/16.jpg",
isFollow:false,
title:"走出去,你才发现你跟别人差的不是一点半点",
titlepic:"../../static/datapic/20.jpg",
support:{
type:"support",
support_count:1,
unsupport_count:2
},
comment_count:4,
share_num:3
}
]
}
},
onLoad() {
},
methods:{
}
}
三、封装列表样式组件
新建文件components->common->common-list.vue将原有的block中的代码复制到common-list.vue文件在common-list中接受item和index首页中导入common-list组件,import commonList from '@/components/common/common-list.vue'首页注册common-listblock中给common-list组件传值
{{item.username}}
+关注
×
{{item.title}}
{{item.support.support_count}}
{{item.support.unsupport_count}}
{{item.comment_count}}
{{item.share_num}}
export default{
props:{
item:Object,
index:Number
}
}
{{item.username}}
+关注
×
{{item.title}}
{{item.support.support_count}}
{{item.support.unsupport_count}}
{{item.comment_count}}
{{item.share_num}}
export default{
props:{
item:Object,
index:Number
}
}