微信小程序 table 简单测试
<view class='AutoTable'> <view id='AutoTableItem'> <block wx:for="{{array}}" wx:for-index="index" wx:for-item="item"> <view wx:if="{{index==0}}"> --如果是第一行 <view class='Autotr'> <view wx:for="{{item.value}}" wx:for-item="Childitem"> <view class="IFAutotd" style="width:{{view_Width}}px;">{{Childitem}}</view> </view> </view> </view> <view wx:else> <view class='Autotr'> <view wx:for="{{item.value}}" wx:for-item="Childitem"> <view class="Autotd" style="width:{{view_Width}}px;">{{Childitem}}</view> </view> </view> </view> </block> </view>
C#代码
public void ProcessRequest(HttpContext context) { /*array: [ { value1: ['125', '65', '97', '24', '93', '97'] }, { value1: ['125', '65', '97', '24', '93', '97'] }, { value1: ['125', '65', '97', '24', '93', '97'] }, { value1: ['125', '65', '97', '24', '93', '97'] }, { value1: ['125', '65', '97', '24', '93', '97'] }, ] */ context.Response.ContentType = "text/plain"; StringBuilder sb = new StringBuilder(); sb.Append("["); sb.Append("{"); //------------------------------ sb.Append("\"Colmn\":6,"); //---- sb.Append("\"ArraylistData\":["); sb.Append("{\"value\":[\"列1\", \"列2\", \"列3\", \"列4\", \"列5\", \"列6\"]},"); sb.Append("{\"value\":[125, 65, 97, 24, 93, 97]},"); sb.Append("{\"value\":[125, 65, 97, 24, 93, 97]},"); sb.Append("{\"value\":[125, 65, 97, 24, 93, 97]},"); sb.Append("{\"value\":[125, 65, 97, 24, 93, 97]},"); sb.Append("{\"value\":[125, 65, 97, 24, 93, 97]}]"); //------------------------------ sb.Append("}"); sb.Append("]"); context.Response.Write(sb.ToString()); }