复制成功!
<template>
<div>
<form-create :rule="rule" v-model:api="fApi" :option="options"/>
<ElButton @click="toJson">生成json</ElButton>
<br/>
<div>
{{ text }}
</div>
</div>
</template>
<script>
export default {
data() {
return {
fApi: {},
text: '',
options: {
submitBtn: false,
},
rule: [
{
type: 'input',
field: 'goods_name',
title: '商品名称',
value: 'form-create'
},
{
type: 'checkbox',
field: 'label',
title: '标签',
value: [0, 1, 2, 3],
options: [
{label: '好用', value: 0},
{label: '快速', value: 1},
{label: '高效', value: 2},
{label: '全能', value: 3},
]
}
]
}
},
methods: {
toJson() {
this.text = 'json: ' + this.fApi.toJson()
}
}
}
</script>