This commit is contained in:
2023-11-07 17:15:33 +08:00
commit fe37e2e1df
418 changed files with 53012 additions and 0 deletions
@@ -0,0 +1,101 @@
<template>
<view class="page">
<!-- 页面内容开始 -->
<vk-data-page-header
title="Dialog 弹窗"
subTitle="基础用法"
></vk-data-page-header>
<view class="page-body">
<el-button @click="dialog.show1 = true">显示弹窗1</el-button>
<el-button @click="dialog.show2 = true">显示弹窗2</el-button>
</view>
<view class="page-dialog">
<!-- 页面弹窗内容开始 -->
<vk-data-dialog
v-model="dialog.show1"
title="标题1"
width="500px"
top="14vh"
center
:close-on-click-modal="true"
>
这里是自定义内容
<template v-slot:footer>
<el-button @click="dialog.show1 = false">取 消</el-button>
<el-button type="primary" @click="dialog.show1 = false">确 定</el-button>
</template>
</vk-data-dialog>
<vk-data-dialog
v-model="dialog.show2"
title="标题2"
width="500px"
top="14vh"
:close-on-click-modal="true"
>
这里是自定义内容
<template v-slot:footer="{ close }">
<el-button @click="close">取 消</el-button>
<el-button type="primary" @click="close">确 定</el-button>
</template>
</vk-data-dialog>
<!-- 页面弹窗内容开始 -->
</view>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
data() {
// 页面数据变量
return {
dialog:{
}
}
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady(){
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options){
}
},
// 过滤器
filters:{
},
// 计算属性
computed:{
}
}
</script>
<style lang="scss" scoped>
</style>
@@ -0,0 +1,141 @@
<template>
<view class="page">
<!-- 页面内容开始 -->
<vk-data-page-header title="Form 表单" subTitle="弹窗表单"></vk-data-page-header>
<view class="page-body">
<el-button @click="form1.props.show = true">弹出表单</el-button>
<el-button @click="resetForm">重置表单</el-button>
<view class="tips mt15">
<view class="mt15 json-view" v-if="form1.data">
<view style="font-size: 14px;">表单数据</view>
<pre>
{{ form1.data }}
</pre>
</view>
</view>
</view>
<!-- 弹窗开始 -->
<vk-data-dialog
v-model="form1.props.show"
title="表单标题"
width="600px"
mode="form"
>
<vk-data-form
ref="form1"
v-model="form1.data"
:action="form1.props.action"
:columns="form1.props.columns"
:rules="form1.props.rules"
:form-type="form1.props.formType"
:loading.sync="form1.props.loading"
:auto-close="true"
label-width="140px"
@success="onFormSuccess"
></vk-data-form>
</vk-data-dialog>
<!-- 弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
data() {
// 页面数据变量
return {
// 表单相关开始-----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {
radio: 1,
checkbox : [1,2]
},
// 表单属性
props: {
// 表单请求地址
action: "template/test/sys/test",
// 表单字段显示规则
columns: [
{ key: "text", title: "text类型字段", type: "text" },
{ key: "number", title: "number类型字段", type: "number" },
{ key: "radio", title: "radio类型字段", type: "radio",
data: [
{ value: 1, label: "选项1" },
{ value: 2, label: "选项2" },
]
},
{ key: "checkbox", title: "checkbox类型字段", type: "checkbox",
data: [
{ value: 1, label: "选项1" },
{ value: 2, label: "选项2" },
]
},
{ key: "textarea", title: "textarea类型字段", type: "textarea",
autosize: { minRows: 4, maxRows: 10 },
maxlength: 200,
showWordLimit: true
},
{ key: "switch", title: "switch类型字段", type: "switch" }
],
// 表单验证规则
rules: {
text: [
{ required: true, message: "text不能为空", trigger: "change" },
]
},
// add 代表添加 update 代表修改
formType: "",
// 表单是否在请求中
loading: false,
// 是否显示表单1 的弹窗
show: false
}
},
// 表单相关结束-----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {},
// 表单提交成功时的回调
onFormSuccess() {
// that.form1.props.show = false;
},
// 重置表单
resetForm() {
let that = this;
if (that.$refs.form1) that.$refs.form1.resetForm();
}
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
</style>
@@ -0,0 +1,119 @@
<template>
<view class="page">
<!-- 页面内容开始 -->
<vk-data-page-header
title="Dialog 弹窗"
subTitle="弹窗表格"
></vk-data-page-header>
<view class="page-body">
<el-button @click="show = true">显示弹窗</el-button>
</view>
<view class="page-dialog">
<!-- 页面弹窗内容开始 -->
<vk-data-dialog
v-model="show"
title="标题"
width="900px"
top="14vh"
center
:close-on-click-modal="true"
>
<!-- 表格组件开始 -->
<vk-data-table
:data="table1.data"
:columns="table1.columns"
:max-height="500"
></vk-data-table>
<!-- 表格组件结束 -->
<template v-slot:footer>
<el-button @click="show = false">取 消</el-button>
<el-button type="primary" @click="show = false">确 定</el-button>
</template>
</vk-data-dialog>
<!-- 页面弹窗内容开始 -->
</view>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
data() {
// 页面数据变量
return {
show:false,
table1:{
// 字段显示规则
columns: [
{ key: "_id" , title: "用户ID" , type: "text" , width: 200 },
{ key: "username" , title: "用户名" , type: "text" , minWidth: 200 },
{ key: "nickname" , title: "用户昵称" , type: "text" , minWidth: 200 },
{ key: "mobile" , title: "手机号" , type: "text" , width: 200 },
],
// 表格数据
data:[
{
_id:"001",
username:`用户名001`,
nickname:`用户昵001`,
mobile:`尾号001`,
},
{
_id:"002",
username:`用户名002`,
nickname:`用户昵002`,
mobile:`尾号002`,
},
{
_id:"003",
username:`用户名003`,
nickname:`用户昵003`,
mobile:`尾号003`,
},
],
}
}
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady(){
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options){
}
},
// 过滤器
filters:{
},
// 计算属性
computed:{
}
}
</script>
<style lang="scss" scoped>
</style>