feat
This commit is contained in:
parent
7874be1d2e
commit
090971a87e
BIN
src/assets/images/basic/leftArrowIcon.png
Normal file
BIN
src/assets/images/basic/leftArrowIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 517 B |
BIN
src/assets/images/basic/rightArrowIcon.png
Normal file
BIN
src/assets/images/basic/rightArrowIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 517 B |
BIN
src/assets/images/basic/tagBG.png
Normal file
BIN
src/assets/images/basic/tagBG.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -3,15 +3,20 @@
|
|||||||
<section class="_content">
|
<section class="_content">
|
||||||
<section class="left_btn"></section>
|
<section class="left_btn"></section>
|
||||||
<section class="_center">
|
<section class="_center">
|
||||||
<img :src="tomatoImg" alt="" />
|
<img :src="current.info.img" alt="" />
|
||||||
</section>
|
</section>
|
||||||
<section class="right_btn"></section>
|
<section class="right_btn"></section>
|
||||||
</section>
|
</section>
|
||||||
<section class="_footer">0000</section>
|
<section class="_footer">
|
||||||
|
<span class="left_btn" @click="handleChange(-1)"></span>
|
||||||
|
<span class="right_btn" @click="handleChange(1)"></span>
|
||||||
|
{{ current.info.name }}{{ current.info.price }}
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
import tomatoImg from '@/assets/images/entities/tomatoImg.png';
|
import tomatoImg from '@/assets/images/entities/tomatoImg.png';
|
||||||
import a from '@/assets/images/entities/1.jpg';
|
import a from '@/assets/images/entities/1.jpg';
|
||||||
import b from '@/assets/images/entities/2.jpg';
|
import b from '@/assets/images/entities/2.jpg';
|
||||||
@ -21,6 +26,73 @@ import e from '@/assets/images/entities/5.jpg';
|
|||||||
import f from '@/assets/images/entities/6.jpg';
|
import f from '@/assets/images/entities/6.jpg';
|
||||||
import g from '@/assets/images/entities/7.jpg';
|
import g from '@/assets/images/entities/7.jpg';
|
||||||
import h from '@/assets/images/entities/8.png';
|
import h from '@/assets/images/entities/8.png';
|
||||||
|
const list = ref([
|
||||||
|
{
|
||||||
|
name: '西红柿',
|
||||||
|
price: '2.5元/公斤',
|
||||||
|
img: tomatoImg,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品aa',
|
||||||
|
price: '3.5元/公斤',
|
||||||
|
img: a,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品bb',
|
||||||
|
price: '4.5元/公斤',
|
||||||
|
img: b,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品cc',
|
||||||
|
price: '5.5元/公斤',
|
||||||
|
img: c,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品dd',
|
||||||
|
price: '34.5元/公斤',
|
||||||
|
img: d,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品ee',
|
||||||
|
price: '55.5元/公斤',
|
||||||
|
img: e,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品ff',
|
||||||
|
price: '222.5元/公斤',
|
||||||
|
img: f,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品gg',
|
||||||
|
price: '32.5元/公斤',
|
||||||
|
img: g,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '产品hh',
|
||||||
|
price: '2.7元/公斤',
|
||||||
|
img: h,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const current = reactive({
|
||||||
|
index: 0,
|
||||||
|
length: list.value.length - 1,
|
||||||
|
info: {
|
||||||
|
name: '西红柿',
|
||||||
|
price: '2.5元/公斤',
|
||||||
|
img: tomatoImg,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
function handleChange(n) {
|
||||||
|
if (current.index == 0 && n == -1) {
|
||||||
|
current.index = current.length;
|
||||||
|
} else if (current.index == current.length && n == 1) {
|
||||||
|
current.index = 0;
|
||||||
|
} else {
|
||||||
|
current.index += n;
|
||||||
|
}
|
||||||
|
console.log('current', current);
|
||||||
|
current.info = list.value[current.index];
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -59,9 +131,29 @@ import h from '@/assets/images/entities/8.png';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
._footer {
|
._footer {
|
||||||
|
position: relative;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
background: url('../../../assets/images/basic/footerBtnTextBG.png') no-repeat center center / cover;
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 40px;
|
||||||
|
background: url('../../../assets/images/basic/tagBG.png') no-repeat center center / cover;
|
||||||
|
span {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
.left_btn {
|
||||||
|
left: 6px;
|
||||||
|
background: url('../../../assets/images/basic/leftArrowIcon.png') no-repeat center center / cover;
|
||||||
|
}
|
||||||
|
.right_btn {
|
||||||
|
right: 6px;
|
||||||
|
background: url('../../../assets/images/basic/rightArrowIcon.png') no-repeat center center / cover;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -44,7 +44,7 @@ const option = reactive({
|
|||||||
},
|
},
|
||||||
subtext: '22.2%',
|
subtext: '22.2%',
|
||||||
subtextStyle: {
|
subtextStyle: {
|
||||||
color: '#07f7c4',
|
color: '#02FD94',
|
||||||
fontSize: '18px',
|
fontSize: '18px',
|
||||||
},
|
},
|
||||||
top: 'center',
|
top: 'center',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user