15
15
<Icon icon =" system-uicons:reset-alt" :size =" 24" />
16
16
</el-button >
17
17
</el-tooltip >
18
- <el-tooltip content =" 预览" >
18
+ <el-tooltip content =" 预览" v-if = " previewUrl " >
19
19
<el-button @click =" handlePreview" >
20
20
<Icon icon =" ep:view" :size =" 24" />
21
21
</el-button >
119
119
</el-aside >
120
120
</el-container >
121
121
</el-container >
122
+ <!-- 预览弹框 -->
123
+ <Dialog v-model =" previewDialogVisible" title =" 预览" width =" 700" >
124
+ <div class =" flex justify-around" >
125
+ <IFrame
126
+ class =" w-375px border-4px border-rounded-8px border-solid p-2px h-667px!"
127
+ :src =" previewUrl"
128
+ />
129
+ <div class =" flex flex-col" >
130
+ <el-text >手机扫码预览</el-text >
131
+ <Qrcode :text =" previewUrl" logo =" /logo.gif" />
132
+ </div >
133
+ </div >
134
+ </Dialog >
122
135
</template >
123
136
<script lang="ts">
124
137
// 注册所有的组件
@@ -137,12 +150,12 @@ import { component as TAB_BAR_COMPONENT } from './components/mobile/TabBar/confi
137
150
import { isString } from ' @/utils/is'
138
151
import { DiyComponent , DiyComponentLibrary , PageConfig } from ' @/components/DiyEditor/util'
139
152
import { componentConfigs } from ' @/components/DiyEditor/components/mobile'
153
+ import { array , oneOfType } from ' vue-types'
154
+ import { propTypes } from ' @/utils/propTypes'
140
155
141
156
/** 页面装修详情页 */
142
157
defineOptions ({ name: ' DiyPageDetail' })
143
158
144
- // 消息弹窗
145
- const message = useMessage ()
146
159
// 左侧组件库
147
160
const componentLibrary = ref ()
148
161
// 页面设置组件
@@ -159,20 +172,22 @@ const selectedComponentIndex = ref<number>(-1)
159
172
// 组件列表
160
173
const pageComponents = ref <DiyComponent <any >[]>([])
161
174
// 定义属性
162
- const props = defineProps < {
175
+ const props = defineProps ( {
163
176
// 页面配置,支持Json字符串
164
- modelValue: string | PageConfig
177
+ modelValue: oneOfType < string | PageConfig >([ String , Object ]). isRequired ,
165
178
// 标题
166
- title: string
179
+ title: propTypes . string . def ( ' ' ),
167
180
// 组件库
168
- libs: DiyComponentLibrary []
181
+ libs: array < DiyComponentLibrary >(),
169
182
// 是否显示顶部导航栏
170
- showNavigationBar: boolean
183
+ showNavigationBar: propTypes . bool . def ( true ),
171
184
// 是否显示底部导航菜单
172
- showTabBar: boolean
185
+ showTabBar: propTypes . bool . def ( false ),
173
186
// 是否显示页面配置
174
- showPageConfig: boolean
175
- }>()
187
+ showPageConfig: propTypes .bool .def (true ),
188
+ // 预览地址:提供了预览地址,才会显示预览按钮
189
+ previewUrl: propTypes .string .def (' ' )
190
+ })
176
191
177
192
// 监听传入的页面配置
178
193
watch (
@@ -315,8 +330,9 @@ const handleReset = () => {
315
330
emits (' reset' )
316
331
}
317
332
// 预览
333
+ const previewDialogVisible = ref (false )
318
334
const handlePreview = () => {
319
- message . warning ( ' 开发中~ ' )
335
+ previewDialogVisible . value = true
320
336
emits (' preview' )
321
337
}
322
338
0 commit comments