hookehuyr

fix 优化表格只读显示

1 <!-- 1 <!--
2 * @Date: 2024-07-12 13:28:27 2 * @Date: 2024-07-12 13:28:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-06 18:16:32 4 + * @LastEditTime: 2024-08-07 10:59:54
5 * @FilePath: /data-table/src/components/TEditor/index.vue 5 * @FilePath: /data-table/src/components/TEditor/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -214,6 +214,7 @@ const tinymceOptions = { ...@@ -214,6 +214,7 @@ const tinymceOptions = {
214 width: $('.table-field-page').width() + 'px', 214 width: $('.table-field-page').width() + 'px',
215 paste_data_images: false, //允许粘贴图像 215 paste_data_images: false, //允许粘贴图像
216 min_height: 300, 216 min_height: 300,
217 + content_style: 'body { font-size: 13px; }', // 设置默认字号为 13px
217 // file_picker_callback: function (cb, value, meta) { 218 // file_picker_callback: function (cb, value, meta) {
218 // var input = document.createElement('input'); 219 // var input = document.createElement('input');
219 // input.setAttribute('type', 'file'); 220 // input.setAttribute('type', 'file');
...@@ -295,6 +296,7 @@ watch( ...@@ -295,6 +296,7 @@ watch(
295 () => props.readonly, 296 () => props.readonly,
296 (newValue, oldValue) => { 297 (newValue, oldValue) => {
297 nextTick(() => { 298 nextTick(() => {
299 + console.warn(newValue);
298 tinymce.activeEditor.mode.set(newValue ? "readonly" : "design"); 300 tinymce.activeEditor.mode.set(newValue ? "readonly" : "design");
299 let iframeDom = document.querySelector("iframe"); 301 let iframeDom = document.querySelector("iframe");
300 iframeDom && 302 iframeDom &&
......
1 <!-- 1 <!--
2 * @Date: 2022-08-29 14:31:20 2 * @Date: 2022-08-29 14:31:20
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-06 18:02:22 4 + * @LastEditTime: 2024-08-07 11:07:29
5 * @FilePath: /data-table/src/components/TableField/index.vue 5 * @FilePath: /data-table/src/components/TableField/index.vue
6 * @Description: 表格组件 6 * @Description: 表格组件
7 --> 7 -->
...@@ -11,15 +11,14 @@ ...@@ -11,15 +11,14 @@
11 <span v-if="item.component_props.required" style="color: red">&nbsp;*</span> 11 <span v-if="item.component_props.required" style="color: red">&nbsp;*</span>
12 <span :class="[ReadonlyShow ? 'readonly-show' : '']">{{ item.component_props.label }}</span> 12 <span :class="[ReadonlyShow ? 'readonly-show' : '']">{{ item.component_props.label }}</span>
13 </div> 13 </div>
14 - <div class="tinymce-box"> 14 + <div v-if="!item.component_props.readonly" class="tinymce-box">
15 <TEditor ref="refEdit" @blur="onBlur" :table_html="table_html" :readonly="item.component_props.readonly"></TEditor> 15 <TEditor ref="refEdit" @blur="onBlur" :table_html="table_html" :readonly="item.component_props.readonly"></TEditor>
16 </div> 16 </div>
17 <!-- <div @click="getValue">获取内容</div> 17 <!-- <div @click="getValue">获取内容</div>
18 <div @click="setValue">设置内容</div> --> 18 <div @click="setValue">设置内容</div> -->
19 - <!-- <div> 19 + <div v-if="item.component_props.readonly" style="padding: 1rem;">
20 <div v-html="table_html" class="table-wrapper"></div> 20 <div v-html="table_html" class="table-wrapper"></div>
21 - <div @click="setHtml">设置内容</div> 21 + </div>
22 - </div> -->
23 <div 22 <div
24 v-if="show_empty" 23 v-if="show_empty"
25 class="van-field__error-message" 24 class="van-field__error-message"
...@@ -56,12 +55,12 @@ const ReadonlyShow = computed(() => { ...@@ -56,12 +55,12 @@ const ReadonlyShow = computed(() => {
56 55
57 onMounted(() => { 56 onMounted(() => {
58 // 57 //
59 - table_html.value = props.item.component_props.note; 58 + table_html.value = props.item.component_props?.default ? props.item.component_props.default : props.item.component_props.note;
60 // 59 //
61 props.item.value = { 60 props.item.value = {
62 key: "table_editor", 61 key: "table_editor",
63 filed_name: props.item.key, 62 filed_name: props.item.key,
64 - value: props.item.component_props.note, 63 + value: props.item.component_props?.default ? props.item.component_props.default : props.item.component_props.note,
65 }; 64 };
66 emit("active", props.item.value); 65 emit("active", props.item.value);
67 // 设置表格显示宽度 66 // 设置表格显示宽度
...@@ -200,6 +199,7 @@ defineExpose({ validTableEditor }); ...@@ -200,6 +199,7 @@ defineExpose({ validTableEditor });
200 199
201 :deep(.table-wrapper) { 200 :deep(.table-wrapper) {
202 overflow: auto; 201 overflow: auto;
202 + font-size: 14px;
203 table { 203 table {
204 width: 100%; 204 width: 100%;
205 border-collapse: collapse; 205 border-collapse: collapse;
......