c5_labsci/fapp/ciyon_ap/pages/demo/comform/radiobox.vue
2026-01-27 00:52:00 +08:00

171 lines
4.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<ciy-header ref="header" title="ciy-radio组件"></ciy-header>
<view>
<view class="ciy-card">
<view class="title">单选框</view>
<view class="content">
相比传统checkbox-group组件可与字典联动<br />
选项数据格式[{id,name}]数组<br />
</view>
</view>
<form @submit="submitlog">
<view class="ciy-form">
<label>原始组件</label>
<view>
<radio-group name="ori">
<label>
<radio value="r1"></radio>选项1
</label>
<label>
<radio value="r2"></radio>选项2
</label>
<label>
<radio value="r3"></radio>选项3
</label>
</radio-group>
</view>
</view>
<view class="ciy-form">
<label>v-model绑定</label>
<view>
<ciy-radio v-model="formvalue" name="ciy1" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>整行排列</label>
<view>
<ciy-radio line itemright hasmore :value="formvalue" name="ciy2" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>禁用</label>
<view>
<ciy-radio left disabled :value="formvalue" name="ciy3" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label class="imp">每行一条</label>
<view>
<ciy-radio line :value="formvalue" name="ciy4" :range="rang" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="ciy-form">
<label>简易range</label>
<view>
<ciy-radio :value="formvalue" name="ciy5" range="10:待处理,20:已处理" @change="chglog('change', $event)"></ciy-radio>
</view>
</view>
<view class="txt-center px4 py4">
<button class="btn" form-type="submit">提交表单</button>
<button class="btn" @tap="formvalue='3'">改变值</button>
</view>
<view class="ciy-card formcard" v-if="formdata">
<view class="content">
<view v-html="tobr(formdata, true)" class="formdata"></view>
</view>
</view>
</form>
<view class="ciy-card">
<view class="title">属性</view>
<view class="content">
<view class="prp">name,value,v-model</view>
<view class="hr"></view>
<view class="prp">hasmore</view>
<view class="tip">
是否form携带更多格式的数据。<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">disabled</view>
<view class="tip">
禁止选择。<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">left</view>
<view class="tip">
是否左侧显示。<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">range</view>
<view class="tip">
选项数组object需包含id,name,upid。<br />
简易字符串id1.name1,id2.name2,...<br />
</view>
<view class="hr"></view>
<view class="prp">itemright</view>
<view class="tip">
是否选项方块在右侧。<br />
默认 false 在左侧
</view>
<view class="hr"></view>
<view class="prp">line</view>
<view class="tip">
是否每一个选项单独一行。<br />
默认 false
</view>
<view class="hr"></view>
<view class="prp">byname (即将废弃)</view>
<view class="tip">
以name匹配选项。<br />
默认 false 以id匹配。
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">方法</view>
<view class="content">
</view>
</view>
<view class="ciy-card">
<view class="title">事件</view>
<view class="content">
<view class="evt">@change, update:modelValue</view>
<view class="tip">
数值变更事件<br />
from: init,check
</view>
<view class="hr"></view>
<view class="log" v-for="(item, index) in eventlog" :key="index">
<text class="code">{{eventlog.length - index}}</text>
{{item}}
</view>
</view>
</view>
<view class="hr"></view>
</view>
</template>
<style>
@import '@/pages/demo/zdemo.css';
</style>
<script>
import zmixin from '@/pages/demo/zmixin.js';
export default {
mixins: [zmixin],
data() {
return {
formvalue: '',
rang: [{
id: 1,
name: '选项1'
}, {
id: 2,
name: '选项2'
}, {
id: 3,
name: '选项3'
}],
}
},
onLoad() {},
methods: {}
}
</script>
<style>
</style>