Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2023-12-19 16:07:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
037e7e2a0e6d2b1a879d696ce3d83ec9b4b6cc2a
037e7e2a
1 parent
df485d59
新增性别判断规则
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
src/components/GenderField/index.vue
src/views/index.vue
src/components/GenderField/index.vue
View file @
037e7e2
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-
02-01 11:18:31
* @LastEditTime: 2023-
12-19 16:05:16
* @FilePath: /data-table/src/components/GenderField/index.vue
* @Description: 性别选择控件
-->
...
...
@@ -19,7 +19,7 @@
:disabled="item.component_props.disabled"
>
<template #input>
<van-radio-group
v-model="item.
value" :direction="item.component_props.direction" style="width: 100%">
<van-radio-group
@change="onChange(item)" v-model="gender_
value" :direction="item.component_props.direction" style="width: 100%">
<div v-for="x in item.component_props.options" :key="x.value" class="radio-wrapper">
<van-radio :name="x.value" icon-size="1rem" :checked-color="themeVars.radioColor"
style="margin-bottom: 0.25rem">{{ x.title }}</van-radio>
...
...
@@ -46,9 +46,22 @@ const HideShow = computed(() => {
return !props.item.component_props.disabled
})
const gender_value = ref(props.item.component_props.default);
onMounted(() => {
props.item.value = props.item.component_props.default;
})
gender_value.value = props.item.component_props.default ? props.item.component_props.default : '';
// 发送自定义数据结构
props.item.value = { key: props.item.key, value: gender_value.value, type: "gender" };
emit("active", props.item.value);
});
const emit = defineEmits(["active"]);
const onChange = (item) => {
// 发送自定义数据结构
props.item.value = { key: props.item.key, value: gender_value.value, type: "gender" };
emit("active", props.item.value);
}
</script>
<style lang="less" scoped>
...
...
src/views/index.vue
View file @
037e7e2
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-1
2 16:42:06
* @LastEditTime: 2023-12-1
9 16:06:34
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -434,19 +434,22 @@ const checkRules = () => {
// 操作绑定自定义字段回调
const onActive = (item) => {
if (item.key === "image_uploader") {
if (item
?
.key === "image_uploader") {
postData.value[item.filed_name] = item.value;
}
if (item.key === "file_uploader") {
if (item
?
.key === "file_uploader") {
postData.value[item.filed_name] = item.value;
}
// if (item.key === "sign") {
// postData.value[item.filed_name] = item.value;
// }
if (item.type === "radio") { // 单选控件
if (item
?
.type === "radio") { // 单选控件
postData.value = _.assign(postData.value, { [item.key]: item.affix ? item.affix : item.value });
}
if (item.type === "checkbox") { // 多选控件
if (item?.type === "gender") { // 性别控件
postData.value = _.assign(postData.value, { [item.key]: item.affix ? item.affix : item.value });
}
if (item?.type === "checkbox") { // 多选控件
const checkbox_value = _.cloneDeep(item.value)
checkbox_value.forEach((element, index) => {
for (const key in item.affix) {
...
...
Please
register
or
login
to post a comment