【修复】(uniapp组件):scroll-view 控制台警告问题

This commit is contained in:
15093570141
2024-10-14 17:42:53 +08:00
parent 835f88cf74
commit f826fc1e34
9 changed files with 43 additions and 43 deletions

View File

@@ -1,7 +1,8 @@
<template> <template>
<view class="core-tabs-box"> <view class="core-tabs-box">
<slot name="left"> </slot> <slot name="left"> </slot>
<scroll-view :scroll-x="true" class="scroll-view" :scroll-left="state.scrollLeft" :scroll-with-animation="true"> <scroll-view :scroll-x="true" class="scroll-view" enable-flex :scroll-left="state.scrollLeft"
:scroll-with-animation="true">
<view v-for="item, index in props.list" :key="index" <view v-for="item, index in props.list" :key="index"
:class="['tab-item-box', { 'on': index === state.current }]" @click="hanldeClickTab(item, index)"> :class="['tab-item-box', { 'on': index === state.current }]" @click="hanldeClickTab(item, index)">
{{ item[props.keyNname] }} {{ item[props.keyNname] }}

View File

@@ -1,6 +1,6 @@
// 不同的环境变量配置 // 不同的环境变量配置
const development = { const development = {
requestBaseUrl: 'https://api.test.pro.coreshop.cn', requestBaseUrl: 'https://api.pro.demo.corecms.cn',
appid: '', appid: '',
} }

View File

@@ -2,11 +2,11 @@ import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
import { NavLinkEnum } from '@/core/enum'; import { NavLinkEnum } from '@/core/enum';
import { queryReceiveCoupon } from '@/core/api'; import { queryReceiveCoupon } from '@/core/api';
export const handleAdvertiseDetail = (type : number, val : string) => { export const handleAdvertiseDetail = (type : number | string, val : string) => {
if (!val) { if (!val) {
return '' return ''
} }
if (type === NavLinkEnum.urlLink) { /** url类型的链接 */ if (type == NavLinkEnum.urlLink) { /** url类型的链接 */
if (val.includes('http')) { if (val.includes('http')) {
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP // #ifdef APP-PLUS || APP-PLUS-NVUE || MP
handleRouteNavigateTo(`/pages/subpackage/webview/webview?src=${val}`); handleRouteNavigateTo(`/pages/subpackage/webview/webview?src=${val}`);
@@ -38,7 +38,7 @@ export const handleAdvertiseDetail = (type : number, val : string) => {
} else if (type == NavLinkEnum.intelligentForms) { /** 自定义表单类型的链接 */ } else if (type == NavLinkEnum.intelligentForms) { /** 自定义表单类型的链接 */
handleRouteNavigateTo(`/pages/subpackage/form/detail/detail?id=${val}`); handleRouteNavigateTo(`/pages/subpackage/form/detail/detail?id=${val}`);
} else if (type == NavLinkEnum.shopCategory) { /** 商品分类类型的链接 */ } else if (type == NavLinkEnum.shopCategory) { /** 商品分类类型的链接 */
handleRouteNavigateTo(`/pages/subpackage/category/list/list?id=${val}`); handleRouteNavigateTo(`/pages/subpackage/category/category?id=${val}`);
} else if (type == NavLinkEnum.wxMiNiProgram) { /** 小程序类型的链接 */ } else if (type == NavLinkEnum.wxMiNiProgram) { /** 小程序类型的链接 */
uni.navigateToMiniProgram({ uni.navigateToMiniProgram({
appId: val, appId: val,

View File

@@ -3,7 +3,7 @@
<!-- 头部大分类 --> <!-- 头部大分类 -->
<view class="big-classify"> <view class="big-classify">
<view class="scroll-view-box"> <view class="scroll-view-box">
<scroll-view class="scroll-view" :scroll-x="true" :scroll-left="state.topScrollLeft" <scroll-view class="scroll-view" enable-flex :scroll-x="true" :scroll-left="state.topScrollLeft"
:scroll-with-animation="true"> :scroll-with-animation="true">
<view :class="['item', { 'on': state.topTabId === item.id }]" <view :class="['item', { 'on': state.topTabId === item.id }]"
v-for="item, index in state.classifyData" :key="index" @click="hanldeChangeTopTab(item, index)"> v-for="item, index in state.classifyData" :key="index" @click="hanldeChangeTopTab(item, index)">
@@ -24,7 +24,7 @@
<view class="classify-box" :style="{ height: `${props.height - state.bigClassifyH}px` }"> <view class="classify-box" :style="{ height: `${props.height - state.bigClassifyH}px` }">
<view class="classify-left"> <view class="classify-left">
<scroll-view class="scroll-view" :scroll-y="true"> <scroll-view class="scroll-view" enable-flex :scroll-y="true">
<view :class="['item', { 'on': state.leftTabId === item.id }]" <view :class="['item', { 'on': state.leftTabId === item.id }]"
v-for="item, index in state.leftTabList" :key="index" @click="hanldeChangeLeftTab(item)"> v-for="item, index in state.leftTabList" :key="index" @click="hanldeChangeLeftTab(item)">
{{ item.name }} {{ item.name }}
@@ -39,7 +39,7 @@
@hanldeClickTab="hanldeChangeRightTab"></coreshop-tabs> @hanldeClickTab="hanldeChangeRightTab"></coreshop-tabs>
</view> </view>
</view> </view>
<scroll-view class="scroll-view" <scroll-view class="scroll-view" enable-flex
:style="{ 'height': `${props.height - state.bigClassifyH - state.rightTabH}px` }" :scroll-y="true" :style="{ 'height': `${props.height - state.bigClassifyH - state.rightTabH}px` }" :scroll-y="true"
@scrolltolower="handleScrolltolower"> @scrolltolower="handleScrolltolower">
<view class="advert-box radius-15 m-b-20"> <view class="advert-box radius-15 m-b-20">
@@ -180,9 +180,9 @@
showSku: false, showSku: false,
goodsDetailData: {}, goodsDetailData: {},
}); });
const emits = defineEmits(['handleShowLoginPopup']); const emits = defineEmits(['handleShowLoginPopup']);
watch(() => props.data, (newVal : Array<CategoriesType>) => { watch(() => props.data, (newVal : Array<CategoriesType>) => {
if (newVal) { if (newVal) {
state.classifyData = newVal.map((item : CategoriesType) => { state.classifyData = newVal.map((item : CategoriesType) => {

View File

@@ -1,7 +1,7 @@
<template> <template>
<view class="classify-box" :style="{height: `${height}px`}"> <view class="classify-box" :style="{height: `${height}px`}">
<view class="classify-left"> <view class="classify-left">
<scroll-view class="scroll-view" :scroll-y="true"> <scroll-view class="scroll-view" enable-flex :scroll-y="true">
<view :class="['item', { 'on': state.leftTabId === item.id }]" v-for="item, index in props.data" <view :class="['item', { 'on': state.leftTabId === item.id }]" v-for="item, index in props.data"
:key="index" @click="hanldeChangeLeftTab(item)"> :key="index" @click="hanldeChangeLeftTab(item)">
{{ item.name }} {{ item.name }}
@@ -9,7 +9,7 @@
</scroll-view> </scroll-view>
</view> </view>
<view class="classify-right"> <view class="classify-right">
<scroll-view class="scroll-view" :scroll-y="true"> <scroll-view class="scroll-view" enable-flex :scroll-y="true">
<view class="advert-box radius-15"> <view class="advert-box radius-15">
<coreshop-advert :code="advertPosition.goodsClassifyBanner"></coreshop-advert> <coreshop-advert :code="advertPosition.goodsClassifyBanner"></coreshop-advert>
</view> </view>

View File

@@ -6,7 +6,7 @@
<coreshop-view-more @hanldeClickViewMore="hanldeClickViewMore"></coreshop-view-more> <coreshop-view-more @hanldeClickViewMore="hanldeClickViewMore"></coreshop-view-more>
</view> </view>
<view class="coupon-card-box"> <view class="coupon-card-box">
<scroll-view :scroll-x="true" class="scroll-box"> <scroll-view :scroll-x="true" enable-flex class="scroll-box">
<view class="card-box" v-for="item, index in props.data?.list?.slice(0, props.data.limit)" <view class="card-box" v-for="item, index in props.data?.list?.slice(0, props.data.limit)"
:key="index"> :key="index">
<image class="coupon-bg" :src="handleStaticResources('/static/images/coupon-bg.jpg')"></image> <image class="coupon-bg" :src="handleStaticResources('/static/images/coupon-bg.jpg')"></image>

View File

@@ -7,7 +7,7 @@
<coreshop-view-more @hanldeClickViewMore="hanldeClickViewMore" color="#fff" <coreshop-view-more @hanldeClickViewMore="hanldeClickViewMore" color="#fff"
:icon="handleStaticResources('/static/images/icon/icon-rigth-fff.png')" /> :icon="handleStaticResources('/static/images/icon/icon-rigth-fff.png')" />
</view> </view>
<scroll-view :scroll-x="true" class="m-t-25 pintuan-box"> <scroll-view :scroll-x="true" enable-flex class="m-t-25 pintuan-box">
<view v-for="item, index in props.data.list" :key="index" class="card-box"> <view v-for="item, index in props.data.list" :key="index" class="card-box">
<coreshop-goods-card imgWidth="290rpx" imgHeight="290rpx" type="vertical" <coreshop-goods-card imgWidth="290rpx" imgHeight="290rpx" type="vertical"
:goodsData="hanldeCombinationGoodsData(item)" @hanldeClickGoods="hanldeClickGoods"> :goodsData="hanldeCombinationGoodsData(item)" @hanldeClickGoods="hanldeClickGoods">

View File

@@ -1,17 +1,17 @@
<template> <template>
<view class="record-box" v-if="state.recordObj" :style="{ <view class="record-box" v-if="Object.keys(state.recordObj).length > 0" :style="{
[props.data.style.align]: 0, [props.data?.style?.align || 'left']: 0,
top: `${props.data.style.top}%` top: `${props.data?.style?.top || 20}%`
}"> }">
<image class="img" :src="state.recordObj.avatar"></image> <image class="img" :src="state.recordObj?.avatar"></image>
<text class="tit">{{state.recordObj.nickname}}{{state.recordObj.createTime}}{{state.recordObj.desc}}</text> <text class="tit">{{state.recordObj?.nickname}}{{state.recordObj?.createTime}}{{state.recordObj?.desc}}</text>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive } from 'vue'; import { reactive ,onMounted } from 'vue';
import { queryRecord } from '@/core/api'; import { queryRecord } from '@/core/api';
import type { Response, RecordType } from '@/core/models' import type { Response, RecordType } from '@/core/models'
import { onHide, onShow } from '@dcloudio/uni-app'; import { onHide } from '@dcloudio/uni-app';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
data : any, data : any,
@@ -25,34 +25,33 @@
}>({ }>({
recordObj: {}, recordObj: {},
times: "", times: "",
})
onMounted(() => {
query();
}) })
// 获取日志 onHide(() => {
const getRecord = async () => { clearInterval(state.times);
const record : Response<RecordType> = await queryRecord({ })
type: 'home',
value: 0,
})
state.recordObj = record.data;
}
const query = () => { const query = () => {
getRecord(); getRecord();
state.times = setInterval(() => { state.times = setInterval(() => {
getRecord(); getRecord();
}, 3000) }, 3000)
} }
onMounted(() => { // 获取日志
query(); const getRecord = async () => {
}) const record : Response<RecordType> = await queryRecord({
type: 'home',
onShow(() => { value: 0,
query(); });
}) if(record.status){
state.recordObj = record?.data;
onHide(() => { };
clearInterval(state.times); }
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './home-record.scss'; @import './home-record.scss';

View File

@@ -8,7 +8,7 @@
</map> </map>
</view> </view>
<view class="store-box"> <view class="store-box">
<scroll-view class="store-list" scroll-y> <scroll-view class="store-list" enable-flex scroll-y>
<view class="item-box" v-for="item in state.storeList" :key="item.id"> <view class="item-box" v-for="item in state.storeList" :key="item.id">
<view class="img-box"> <view class="img-box">
<image class="img" :src="item.logoImage"></image> <image class="img" :src="item.logoImage"></image>