-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-inline-layout.html
More file actions
123 lines (108 loc) · 4.44 KB
/
test-inline-layout.html
File metadata and controls
123 lines (108 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>測試 Inline Layout</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://unpkg.com/element-plus/dist/index.css" rel="stylesheet">
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://unpkg.com/element-plus/dist/index.full.js"></script>
<style>
body { margin: 0; padding: 20px; background: #f5f7fa; }
.preview-container { background: white; border-radius: 8px; padding: 20px; }
/* 測試用邊框 */
.col { border: 2px solid blue; }
.field-label { background: lightblue; }
.el-input { background: lightgreen; }
/* 智慧表單容器 */
.has-inline-form-components {
font-size: 0 !important;
line-height: 1.5 !important;
border: 3px solid red !important; /* 測試用 */
}
.has-inline-form-components > * {
font-size: 14px !important;
display: inline-block !important;
vertical-align: middle !important;
}
.has-inline-form-components > span {
white-space: nowrap !important;
}
/* Bootstrap Grid 特殊處理 */
.col.has-inline-form-components {
display: block !important;
}
.col.has-inline-form-components > * {
font-size: 14px !important;
display: inline-block !important;
vertical-align: middle !important;
}
</style>
</head>
<body>
<div id="app" class="preview-container">
<h3>測試 1: 基本結構</h3>
<div class="col has-inline-form-components" style="padding: 10px; min-height: 50px;">
<span class="field-label" style="display: inline-block; font-size: 14px; margin-right: 10px;">表單標籤</span>
<el-input placeholder="請輸入" style="width: 200px;"></el-input>
</div>
<h3>測試 2: 檢查 display 值</h3>
<div id="test-info"></div>
</div>
<script>
const { createApp } = Vue
const app = createApp({
mounted() {
// 延遲檢查,確保 Vue 已經渲染完成
setTimeout(() => {
const container = document.querySelector('.col.has-inline-form-components')
const span = container.querySelector('span')
const elInput = container.querySelector('.el-input')
const info = document.getElementById('test-info')
info.innerHTML = `
<p><strong>Container (.col.has-inline-form-components):</strong></p>
<p>- display: ${window.getComputedStyle(container).display}</p>
<p>- font-size: ${window.getComputedStyle(container).fontSize}</p>
<p><strong>Span (.field-label):</strong></p>
<p>- display: ${window.getComputedStyle(span).display}</p>
<p>- font-size: ${window.getComputedStyle(span).fontSize}</p>
<p>- vertical-align: ${window.getComputedStyle(span).verticalAlign}</p>
<p><strong>El-Input:</strong></p>
<p>- display: ${window.getComputedStyle(elInput).display}</p>
<p>- font-size: ${window.getComputedStyle(elInput).fontSize}</p>
<p>- vertical-align: ${window.getComputedStyle(elInput).verticalAlign}</p>
`
console.log('Container:', container)
console.log('Container display:', window.getComputedStyle(container).display)
console.log('Span display:', window.getComputedStyle(span).display)
console.log('El-Input display:', window.getComputedStyle(elInput).display)
}, 500)
}
})
app.use(ElementPlus)
app.mount('#app')
// 第二次注入 CSS (模擬我們的動態注入)
setTimeout(() => {
console.log('Injecting dynamic CSS...')
const style = document.createElement('style')
style.textContent = `
.has-inline-form-components > * {
display: inline-block !important;
vertical-align: middle !important;
}
.col.has-inline-form-components > * {
display: inline-block !important;
vertical-align: middle !important;
}
.has-inline-form-components [class*="el-input"] {
display: inline-block !important;
vertical-align: middle !important;
}
`
document.head.appendChild(style)
console.log('Dynamic CSS injected')
}, 100)
</script>
</body>
</html>