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-06 11:51:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9b2073e30bb680bcc96f7af4f2e32a20cd1adfd3
9b2073e3
1 parent
df2effdb
fix 细节和注释调整
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
82 deletions
src/components/TableField/index.vue
src/components/TableField/index.vue
View file @
9b2073e
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-08-06
09:41:32
* @LastEditTime: 2024-08-06
11:51:06
* @FilePath: /data-table/src/components/TableField/index.vue
* @Description:
文件描述
* @Description:
表格组件
-->
<template>
<div v-if="HideShow" class="table-field-page">
...
...
@@ -55,11 +55,6 @@ const ReadonlyShow = computed(() => {
});
onMounted(() => {
nextTick(() => {
setTimeout(() => {
$('.tinymce-box').width($('.table-field-page').width() + 'px');
}, 100);
})
//
table_html.value = props.item.component_props.note;
//
...
...
@@ -69,13 +64,12 @@ onMounted(() => {
value: props.item.component_props.note,
};
emit("active", props.item.value);
// setTimeout(() => {
// }, 1000);
// nextTick(() => {
// if (refEdit.value) {
// refEdit.value.handleSetContent(props.item.component_props.note)
// }
// })
// 设置表格显示宽度
nextTick(() => {
setTimeout(() => {
$('.tinymce-box').width($('.table-field-page').width() + 'px');
}, 100);
})
});
const refEdit = ref(null);
...
...
@@ -85,9 +79,9 @@ const getValue = () => {
console.warn(refEdit.value.handleGetContent());
}
const setValue = () => {
refEdit.value.handleSetContent(table)
}
//
const setValue = () => {
//
refEdit.value.handleSetContent(table)
//
}
const table_html = ref('');
// const setHtml = () => {
...
...
@@ -104,77 +98,77 @@ const onBlur = (html) => {
emit("active", props.item.value);
}
const table = `
<table>
<thead>
<tr>
<th>姓名</th>
<th>年龄</th>
<th>城市</th>
<th>姓名</th>
<th>年龄</th>
<th>城市</th>
<th>姓名</th>
<th>年龄</th>
<th>城市</th>
<th>姓名</th>
<th>年龄</th>
<th>城市</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>28</td>
<td>北京</td>
<td>张三</td>
<td>28</td>
<td>北京</td>
<td>张三</td>
<td>28</td>
<td>北京</td>
<td>张三</td>
<td>28</td>
<td>北京</td>
</tr>
<tr>
<td>李四</td>
<td>34</td>
<td>上海</td>
<td>李四</td>
<td>34</td>
<td>上海</td>
<td>李四</td>
<td>34</td>
<td>上海</td>
<td>李四</td>
<td>34</td>
<td>上海</td>
</tr>
<tr>
<td>王五</td>
<td>22</td>
<td>广州</td>
<td>王五</td>
<td>22</td>
<td>广州</td>
<td>王五</td>
<td>22</td>
<td>广州</td>
<td>王五</td>
<td>22</td>
<td>广州</td>
</tr>
</tbody>
</table>
`
//
const table = `
//
<table>
//
<thead>
//
<tr>
//
<th>姓名</th>
//
<th>年龄</th>
//
<th>城市</th>
//
<th>姓名</th>
//
<th>年龄</th>
//
<th>城市</th>
//
<th>姓名</th>
//
<th>年龄</th>
//
<th>城市</th>
//
<th>姓名</th>
//
<th>年龄</th>
//
<th>城市</th>
//
</tr>
//
</thead>
//
<tbody>
//
<tr>
//
<td>张三</td>
//
<td>28</td>
//
<td>北京</td>
//
<td>张三</td>
//
<td>28</td>
//
<td>北京</td>
//
<td>张三</td>
//
<td>28</td>
//
<td>北京</td>
//
<td>张三</td>
//
<td>28</td>
//
<td>北京</td>
//
</tr>
//
<tr>
//
<td>李四</td>
//
<td>34</td>
//
<td>上海</td>
//
<td>李四</td>
//
<td>34</td>
//
<td>上海</td>
//
<td>李四</td>
//
<td>34</td>
//
<td>上海</td>
//
<td>李四</td>
//
<td>34</td>
//
<td>上海</td>
//
</tr>
//
<tr>
//
<td>王五</td>
//
<td>22</td>
//
<td>广州</td>
//
<td>王五</td>
//
<td>22</td>
//
<td>广州</td>
//
<td>王五</td>
//
<td>22</td>
//
<td>广州</td>
//
<td>王五</td>
//
<td>22</td>
//
<td>广州</td>
//
</tr>
//
</tbody>
//
</table>
//
`
const show_empty = ref(false);
// 校验模块
const validTableEditor = () => {
if (props.item.component_props.disabled) { // 通过规则隐藏的属性,不校验
show_empty.value = false;
} else {
// 必填项
未上传文件
// 必填项
if (props.item.component_props.required && !refEdit.value.handleGetContent()) {
show_empty.value = true;
showToast(props.item.component_props.label + "必填项未填写");
...
...
Please
register
or
login
to post a comment