配置
配置 |
类型 |
默认值 |
备注 |
temp-name |
String |
'' |
流水号模版编号 |
auto |
Boolean |
true |
是否自动获取流水号 |
方法
方法名 |
定义 |
备注 |
refresh |
() |
手动获取/刷新流水号 |
显示文本
<p-sn :temp-name="tplNameOne" v-model="snOne"></p-sn>
slot
<el-form ref="refForm" :model="form" :rules="formRule">
<p-sn :temp-name="tplNameTwo" v-model="form.sn" :auto="false" ref="sn">
<!-- 配合el-form使用 -->>
<tpl v-slot="scope">
<el-form-item label="流水号" prop="sn">
<el-input :value="scope.value" readonly></el-input>
</el-form-item>
</tpl>
</p-sn>
<el-button type="primary" v-on:click="saveData"> 校验非空 </el-button>
</el-form>
data() {
return {
formRule: {
sn: [{ required: true, message: '流水号不能为空' }],
},
form: {
sn: undefined,
},
}
},
methods: {
saveData() {
try {
this.$refs.refForm.validate()
} catch (e) {}
},
refreshSn() {
this.$refs.sn.refresh()
},
clearSn() {
this.tplNameTwo = ''
},
}
文档更新时间: 2021-05-12 18:47 作者:管理员