当前位置:网站首页>Harmony美食菜单界面
Harmony美食菜单界面
2022-06-25 06:38:00 【respectable-face】
运行效果图

代码段

data中代码cookbook-hotcat.json
[
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "家常菜"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "汤"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "川菜"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "粤菜"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "早餐"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "火锅"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "素菜"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "粥"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "凉菜"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "烘烤"
},
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"title": "饮品"
}
]data中代码cookbook-list.json
{
"ret": true,
"data": [
{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
},{
"img": "https://i.postimg.cc/pLZ0kNL8/pic-01.jpg",
"all_click": "3334.9\u4e07",
"favorites": "20.4\u4e07"
}
]
}news中hotcake代码hml
<div class="cb-hc-container">
<div class="cb=hc-title">
<text>
热门分类
</text>
</div>
<div class="cb-hc-list">
<div class="cb-hc-item" for="{
{list}}">
<image src="{
{$item.img}}"></image>
<text>{
{$item.title}}</text>
</div>
</div>
</div>news中hotcake代码js
// @ts-nocheck
import list from '../../../common/data/cookbook-hotcat.json'
export default{
data:{
list:[]
},
onReady(){
this.list=list
}
}news中hotcake代码css
.cb-hc-container {
flex-direction: column;
}
.cb-hc-title {
border-bottom-width: 0.5px;
border-bottom-color: #eee;
height: 44px;
}
text {
font-size: 12px;
padding-left: 10px;
}
.cb-hc-list {
flex-wrap: wrap;
margin-top: 20px;
}
.cb-hc-item {
width: 33.33333%;
flex-direction: column;
justify-content: center;
align-items: center;
margin-bottom: 20px;
}
image {
object-fit: cover;
width: 70px;
height: 70px;
border-radius: 8px;
}
text {
font-size: 14px;
line-height: 30px;
}
swiper中代码hml
<div class="cb-swiper-container">
<swiper>
<image for="{
{list.slice(0,5)}}" src="{
{$item.img}}">
</image>
</swiper>
</div>swiper中代码js
export default{
props:{
list:{
type:Array
}
},
onReady(){
console.log(this.list)
}
}
swiper中代码css
.cb-swiper-container {
height: 240px;
}
swiper {
width: 100%;
}
image {
width: 100%;
height: 100%;
object-fit: fill;
}top中代码hml
<div class="cb-top-container">
<div class="cb-title-title">
<text>
精品好菜
</text>
</div>
<div class="cb-top-body">
<div class="cb-top-item" for="{
{list.slice(0,10)}}">
<image src="{
{$item.img}}"></image>
<div class="cb-top-item-info">
<text class="cb-top-item-title">
{
{$item.name}}
</text>
<text class="cb-top-item-subtitle">
{
{$item.all_click}}浏览{
{$item.favorites}}收藏
</text>
</div>
</div>
</div>
</div>
top中代码js
export default{
props:{
list:{
type:Array
}
},
onReady(){
console.log(this.list)
}
}
top中代码css
.cb-top-container {
flex-direction: column;
background-color: #f5f5f5;
}
.cb-title-title {
height: 50px;
padding-top: 5px;
padding-left: 10px;
color: #333;
}
text {
font-size: 12px;
}
.cb-top-body {
flex-wrap: wrap;
padding-left: 10px;
padding-right: 10px;
}
.cb-top-item {
width: 50%;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: white;
padding-bottom: 15px;
margin-bottom: 10px;
height: 160px;
}
image {
width: 100%;
flex: 1;
object-fit: contain;
}
.cb-top-item-info {
height: 50px;
flex-direction: column;
align-items: center;
}
.cb-top-item-title {
font-size: 16px;
}
.cb-top-item-subtitle {
font-size: 12px;
color: #666;
font-weight: 100;
}
news中index.hml代码
<element name='cb-hotcake' src='./hotcake/hotcake'></element>
<element name='cb-swiper' src='./swiper/swiper.hml'></element>
<element name='cb-top' src='./top/top.hml'></element>
<element name='comp' src='../../components/tabbar/tabbar.hml'></element>
<div class="cb-container">
<div class="cb-title">
<text>
新闻中心
</text>
</div>
<div class="cb-body">
<list>
<list-item class="cb-body-item">
<!-- <cb-hotcake></cb-hotcake>-->
<cb-swiper list="{
{list}}"></cb-swiper>
<!-- <cb-hotcake></cb-hotcake>-->
</list-item>
</list>
</div>
<div class="cb-body">
<list>
<list-item class="cb-body-item">
<cb-hotcake></cb-hotcake>
<!-- <cb-hotcake></cb-hotcake>-->
</list-item>
</list>
</div>
<div class="cb-body">
<list>
<list-item class="cb-body-item">
<cb-top list="{
{list}}"></cb-top>
</list-item>
</list>
<comp index="1"></comp>
</div>
</div>
news中index.js代码
// @ts-nocheck
import list from '../../common/data/cookbook-list.json'
export default {
data: {
list:[]
// title: ""
},
onInit() {
this.list=list.data;
// this.title = this.$t('strings.world');
}
}
news中index.css代码
.cb-container {
flex-direction: column;
}
.cb-title {
width: 100%;
height: 44px;
justify-content: center;
align-items: center;
background-color: #ee742f;
}
text {
color: white;
font-size: 16px;
font-weight: normal;
}
.cb-body {
flex: 1;
}
.cb-body-item {
flex-direction: column;
}
边栏推荐
- 我们不一样
- 【xxl-job】池塘水绿风微暖,记得玉真初见面
- Design a MySQL table for message queue to store message data
- 活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热来袭
- Operate cnblogs metaweblog API
- Simple and complete steps of vivado project
- I have used it for six years!
- Shandong finds clean energy that can be used by China for 3800 years? You should know the truth first
- Astronomers may use pulsars to detect merged supermassive black holes
- 313. Binary sum
猜你喜欢

Understand ZBrush carving software and game modeling analysis

Love Terminator

Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer

Design of PWM breathing lamp based on FPGA

破万,我用了六年!

Uncaught TypeError: Cannot read properties of undefined (reading ‘prototype‘)

活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热报名中

Loopholes in the missed scanning system of Lvmeng and its repair scheme

Navicat prevent new query from being deleted by mistake

1W字|40 图|硬核 ES 实战
随机推荐
基于 KubeSphere 的分级管理实践
レ / leilei
Non-contact infrared temperature measurement system for human body based on single chip microcomputer
In depth analysis of Apache bookkeeper series: Part 3 - reading principle
Design a MySQL table for message queue to store message data
Direct select sort and quick sort
Kube scheduler source code analysis (1) - initialization and startup analysis
[C language] one dimensional array
Conditional grouping with $exists inside $cond
joda. Time get date summary
弱大数定理的意义与证明
Display purchase Summary - Dell 2705qm BenQ pd2700u
Analysis on the trend of the number of national cinemas, film viewers and average ticket prices in 2021 [figure]
Is it possible to use Jasmine's toHaveBeenCalledWith matcher with a regular expression?
How to store the directory / hierarchy / tree structure in the database- How to store directory / hierarchy / tree structure in the database?
Cloning and importing DOM nodes
分布式锁中的王者方案 - Redisson
Make fertilizer Safi from crop residues locally to increase yield by 30% and improve soil
Event registration | Apache pulsar x kubesphere online meetup is coming
Why is true == "true" true in R- Why TRUE == “TRUE” is TRUE in R?