yf_elsa.cui před 14 hodinami
rodič
revize
2607186bce
1 změnil soubory, kde provedl 10 přidání a 5 odebrání
  1. 10 5
      pages/environment/history-new.vue

+ 10 - 5
pages/environment/history-new.vue

@@ -40,10 +40,10 @@
 					</view>
 					<u-calendar v-model="tiemshow" mode="range" @change="tiemchange"></u-calendar>
 				</view>
-				<view class="condition" v-if="scrollTF">
+				<view class="condition" >
 					<scroll-view scroll-top="0" scroll-x="true" class="scroll-X">
 						<!-- @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" -->
-						<table class="table" :style="{width:300+240*datalength+'rpx'}">
+						<table class="table" :style="{width:twidth}">
 							<tr class="tr">
 								
 								<th class="th" v-for="(item,index) in thdata" :key="index">
@@ -54,7 +54,7 @@
 							
 							</tr>
 							<tr class="tr" v-if="forbidden">
-								<td class="td" v-for="item in thdata.length">暂无数据</td>
+								<td class="td" v-for="item in Object.keys(thdata).length">暂无数据</td>
 							</tr>
 						</table>
 					</scroll-view>
@@ -79,6 +79,11 @@
 	var canvasColumnA = null;
 	var presenttime = +new Date();
 	export default {
+		computed:{
+			twidth(){
+				return 240 * Object.keys(this.thdata).length +'rpx' || 300 + 'rpx'
+			}
+		},
 		data() {
 			return {
 				cWidth: '400',
@@ -94,7 +99,7 @@
 				tiemshow: false, //选择时间
 				tishiTF: false, //提示
 				historydatas: [],
-				thdata:[],
+				thdata:{},
 				tableData:[],
 				page: 1,
 				forbidden: false,
@@ -122,7 +127,7 @@
 				this.thdata = res.title
 				console.log(res)
 
-				if (this.thdata == 0) {
+				if (this.tableData.length == 0) {
 					this.scrollTF = false
 				} else {
 					this.scrollTF = true