代码拉取完成,页面将自动刷新
<script>
// export default {
// onLaunch: function() {
// console.log('App Launch')
// },
// onShow: function() {
// console.log('App Show')
// },
// onHide: function() {
// console.log('App Hide')
// }
// }
</script>
<script setup>
// 引入依赖
import { onShow,onLaunch,onHide,onLoad } from "@dcloudio/uni-app"
import {ref } from 'vue'
import api from "@/api/index"
// store
import { useStore } from '@/store'
const store = useStore()
// const sHeight = ref(0)
store.appInit()
// 生命周期
onLaunch(() => {
console.log('App Launch')
store.checkLogin() // 检查是否登录
store.appInit()
store.getCartList() // 加载购物车
uni.getSystemInfo({
success:function(res){
// console.log(res.screenHeight)
store.systemInfo = res
// sHeight.value = res.screenHeight
}
})
getAddress()
// 保存店铺默认地址
})
onShow(() => {
console.log('App Show')
})
onHide(() => {
console.log('App Hide')
})
async function getAddress() {
const res = await api.getDefaultAddress()
if(res.code ===1 ) {
// addressInfo.value = res.data
store.address = res.data
}
// if(!addressInfo.value) { // 没有地址
// toAddress()
// }
}
</script>
<style lang="scss">
/*每个页面公共css */
image{
height:auto
}
.page-bg-gray{
background: rgb(248, 248, 248);
}
.page-box{
/* height: 100%;
overflow: scroll; */
min-height: 100%;
}
uni-page-body,page{
height: 100%;
}
page{
font-size: 28rpx;
}
.text-ellipsis-1{ /*超出部分省略号 单行*/
overflow:hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
/* min-height: 38rpx; */
}
.icon-custom{
width: 32rpx;
height: 32rpx;
}
.small-text{
color: gray !important;
font-size: 24rpx;
font-weight: 100 !important;
}
.bold-text{
font-weight: 600;
font-size: 36rpx;
}
.margin-line{
height: 20rpx;
width: 100%;
background-color: rgb(248, 248, 248);
}
.clearCss{
opacity: 0 !important;
}
.shim{/* 垫片 */
width: 100%;
height: 140rpx;
}
.big-text{
font-size: 80rpx;
/* font-weight: 600; */
}
.red-text{
color: red;
}
.line{
height: 2rpx;
width: 100%;
background-color: #e7e7e7;
}
.num-show{
position: absolute;
width: 40rpx;
height: 40rpx;
color: white;
background: #7cc4e8;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
top: -24rpx;
right: -10rpx;
border: 2rpx solid white;
}
/* 通用卡片样式 */
.u-card{
background-color: white;
.u-card-row:last-child{
border-bottom: unset;
}
.u-card-row{
padding: 40rpx;
border-bottom: 2rpx solid #e7e7e7;
.u-card-row-btn{
color: #086EC7;
}
.u-card-row-top,.u-card-row-content{
display: flex;
align-items: center;
justify-content: space-between;
}
.u-card-row-top{
padding-bottom: 40rpx;
.u-card-left{
}
.u-card-right{
.u-card-right-btn{
color:#7cc4e8
}
}
}
.u-card-row-content{
.u-card-left{
// width: 50%;
}
.u-card-right{
// width: 50%;
display: flex;
}
}
}
}
// 弹出窗样式
.popup-content{
padding-top: 40rpx;
background-color: white;
border-radius: 20rpx 20rpx 0 0;
overflow: scroll;
}
.small-btn-css{
background: #7CC4E8;
color: white;
padding: 6rpx 40rpx;
border-radius: 40rpx;
font-size: 28rpx;
white-space: nowrap;
margin-left: 10rpx;
position: relative;
}
.cancel-btn{
display: block;
margin-top: 20rpx;
.add-btn{
background: white !important;
color: black !important;
border: 2rpx solid #7cc4e8 !important;
}
}
.invalidCss{
background-color: #767676 !important;
}
:deep(){
.uni-popup__wrapper{
bottom: -34px;
}
.popup-content{
bottom: -34px;
padding-bottom: 34px;
background-color: white;
}
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。