mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 08:48:06 +08:00
79 lines
3.5 KiB
Plaintext
79 lines
3.5 KiB
Plaintext
<template name="action">
|
|
<view class="action">
|
|
<view class="item" wx:for="{{action}}" wx:key="index">
|
|
<button bindtap="onaction" data-name="{{item}}" size="mini">{{item}}</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<template name="list">
|
|
<view class="output">
|
|
<view class="item" wx:for="{{list}}" wx:key="index">
|
|
<view bindtap="ondetail" class="item" data-index="{{index}}">{{item.name}}</view>
|
|
<view class="list" wx:if="{{item._show}}">
|
|
<view bindtap="onchange" class="item" wx:for="{{item.list}}" wx:for-index="i" wx:key="i"
|
|
data-i="{{i}}" data-index="{{index}}">{{item.name}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<template name="field">
|
|
<view class="output">
|
|
<view class="field" wx:for="{{list}}" wx:for-index="order" wx:for-item="field" wx:key="index">
|
|
<view class="title"><text>{{field.name}}({{field.help}})</text></view>
|
|
<view class="option"> <!-- 参数 -->
|
|
<view class="item {{item.type}}" wx:for="{{field.inputs}}" wx:key="name">
|
|
<!-- 文本 -->
|
|
<textarea wx:if="{{item.type == 'textarea'}}" placeholder="{{item.name}}" value="{{item.value}}"
|
|
bindinput="onInput" data-index="{{index}}" data-order="{{order}}"></textarea>
|
|
|
|
<!-- 文本 -->
|
|
<input wx:elif="{{item.type == 'text'}}" placeholder="{{item.name}}" value="{{item.value}}" type="text"
|
|
bindinput="onInput" data-index="{{index}}" data-order="{{order}}"/>
|
|
|
|
<!-- 列表 -->
|
|
<picker wx:elif="{{item.type == 'select'}}" range="{{item.values}}" value="{{item.index||0}}"
|
|
bindchange="onChange" data-index="{{index}}" data-order="{{order}}">
|
|
<view>{{item.values[item.index||0]}}</view>
|
|
</picker>
|
|
|
|
<!-- 按钮 -->
|
|
<button wx:elif="{{item.type == 'button'}}" size="mini"
|
|
bindtap="onClick" data-index="{{index}}" data-order="{{order}}">{{item.value||item.name}}</button>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="output"> <!-- 输出 -->
|
|
<!-- 表格 -->
|
|
<template is="table" data="{{order: order, msg: field.msg}}"></template>
|
|
|
|
<!-- 文本 -->
|
|
<view class="code"><rich-text wx:for="{{field.msg.result}}" wx:key="index" nodes="{{item}}"></rich-text></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<template name="table">
|
|
<table wx:if="{{msg}}">
|
|
<tr><th wx:for="{{msg.append}}" wx:key="index">{{item}}</th></tr>
|
|
<tr wx:for="{{msg._index}}" wx:key="index">
|
|
<td wx:for="{{msg.append}}" wx:for-index="i" wx:key="index">
|
|
<view class="which" bindtap="onWhich" wx:for="{{msg._view[item][index]}}" wx:for-item="input" wx:for-index="i" wx:key="i"
|
|
data-input="{{input}}" data-value="{{input._text}}" data-key="{{item}}" data-index="{{index}}" data-order="{{order}}">
|
|
<template data="{{input}}" is="input"></template>
|
|
</view>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</template>
|
|
|
|
<template name="input">
|
|
<view bindtap="onWhich" wx:if="{{input._type == 'text'}}">{{input._text}}</view>
|
|
<rich-text bindtap="onWhich" wx:if="{{input._type == 'div'}}" nodes="{{input._text}}"></rich-text>
|
|
<image bindtap="onWhich" wx:if="{{input._type == 'img'}}" mode="aspectFit" src="{{input.src}}"></image>
|
|
<button bindtap="onWhich" wx:if="{{input._type == 'input' && input.type == 'button'}}" size="mini">{{input.value||input.name}}</button>
|
|
</template>
|
|
|