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
2024-08-19 15:23:49 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bbb414768ca2b2e4ce281e0595e5c1f8b0d3c107
bbb41476
1 parent
7fce06a4
给联系人相关字段绑定监听事件用于更新值变化
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
7 deletions
src/components/GenderField/index.vue
src/components/IdentityField/index.vue
src/components/NameField/index.vue
src/components/NumberField/index.vue
src/components/PhoneField/index.vue
src/views/index.vue
src/components/GenderField/index.vue
View file @
bbb4147
<!--
* @Date: 2022-08-30 11:34:19
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-
07 18:14:05
* @LastEditTime: 2024-08-
19 15:21:52
* @FilePath: /data-table/src/components/GenderField/index.vue
* @Description: 性别选择控件
-->
...
...
@@ -65,6 +65,19 @@ onMounted(() => {
emit("active", props.item.value);
});
// 监听默认值变化
watch(
() => props.item.component_props.default,
(v) => {
if (v) {
gender_value.value = v;
// 发送自定义数据结构
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) => {
...
...
src/components/IdentityField/index.vue
View file @
bbb4147
<!--
* @Date: 2022-09-14 14:44:30
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-1
3 15:48:11
* @LastEditTime: 2024-08-1
9 15:22:29
* @FilePath: /data-table/src/components/IdentityField/index.vue
* @Description: 身份证输入控件
-->
...
...
@@ -100,6 +100,16 @@ watch(
}
);
// 监听默认值变化
watch(
() => props.item.component_props.default,
(v) => {
if (v) {
props.item.value = v;
}
}
);
var checkProv = function (val) {
var pattern = /^[1-9][0-9]/;
var provs = {11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北 ",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏 ",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门"};
...
...
src/components/NameField/index.vue
View file @
bbb4147
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-1
2 18:03:4
4
* @LastEditTime: 2024-08-1
9 15:22:3
4
* @FilePath: /data-table/src/components/NameField/index.vue
* @Description: 姓名输入框
-->
...
...
@@ -55,7 +55,17 @@ const isGroup = computed(() => {
onMounted(() => {
props.item.value = props.item.component_props.default;
})
});
// 监听默认值变化
watch(
() => props.item.component_props.default,
(v) => {
if (v) {
props.item.value = v;
}
}
);
</script>
<style lang="less" scoped>
...
...
src/components/NumberField/index.vue
View file @
bbb4147
<!--
* @Date: 2022-09-14 14:44:30
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-
07 18:14:33
* @LastEditTime: 2024-08-
19 15:22:41
* @FilePath: /data-table/src/components/NumberField/index.vue
* @Description: 数字输入框
-->
...
...
@@ -96,6 +96,17 @@ watch(
}
}
);
// 监听默认值变化
watch(
() => props.item.component_props.default,
(v) => {
if (v) {
props.item.value = v;
}
}
);
const readonly = props.item.component_props.readonly;
const showKeyboard = (e) => {
if (readonly) return false; // 如果为只读,不能设置
...
...
src/components/PhoneField/index.vue
View file @
bbb4147
<!--
* @Date: 2022-09-02 10:46:03
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-1
2 17:39:00
* @LastEditTime: 2024-08-1
9 15:17:46
* @FilePath: /data-table/src/components/PhoneField/index.vue
* @Description: 手机输入框
-->
...
...
@@ -133,6 +133,16 @@ watch(
}
);
// 监听默认值变化
watch(
() => props.item.component_props.default,
(v) => {
if (v) {
props.item.value = v;
}
}
);
const openKeyboard = (e) => {
if (props.item.component_props.readonly) return false; // 如果为只读,不能设置
// 键盘上移动
...
...
src/views/index.vue
View file @
bbb4147
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-1
4 14:28:08
* @LastEditTime: 2024-08-1
9 15:17:29
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
...
...
@@ -542,6 +542,18 @@ onMounted(async () => {
document.documentElement.style.setProperty('--border-style', '0');
})
}
// TODO: iframe通信-读取联系人身份证信息
window.addEventListener('message', (ev) => {
let data = ev.data || null;
console.warn('读取联系人身份证信息', data);
const objectMap = new Map(data.map(item => [item.key, item.value]));
formData.value.forEach((item) => {
// TODO: 绑定别名字段-待确定
if (objectMap.has(item.component_props.tag)) {
item.component_props.default = objectMap.get(item.component_props.tag);
}
});
}, false);
});
// 打开轮询用户是否关注
...
...
Please
register
or
login
to post a comment