fix: only apply iframe for demos with browser window

This commit is contained in:
Justineo 2022-05-06 12:52:23 +08:00
parent fa9468a7d3
commit 9f25df8b89
No known key found for this signature in database
GPG Key ID: B73F0979CF18A0EA
2 changed files with 16 additions and 1 deletions

View File

@ -68,7 +68,10 @@
'live-preview-browser': browser 'live-preview-browser': browser
}" }"
> >
<one-iframe global-style="body { margin: 0 !important; } body > article { margin: 24px 36px; } .veui-layout { min-width: auto !important; }"> <one-iframe
v-if="browser"
global-style="body { margin: 0 !important; } body > article { margin: 24px 36px; } .veui-layout { min-width: auto !important; }"
>
<v-live-preview <v-live-preview
class="editor-preview" class="editor-preview"
:code="transformedCode" :code="transformedCode"
@ -78,6 +81,15 @@
@error="handleError" @error="handleError"
/> />
</one-iframe> </one-iframe>
<v-live-preview
v-else
class="editor-preview"
:code="transformedCode"
:requires="imports"
:check-variable-availability="false"
@success="dismissError"
@error="handleError"
/>
<transition name="editor-error"> <transition name="editor-error">
<veui-alert <veui-alert
v-if="error" v-if="error"

View File

@ -121,6 +121,9 @@ Icon.register({
flex 1 1 auto flex 1 1 auto
height calc(100% - 48px) height calc(100% - 48px)
& >>> .live-preview
padding 24px 36px
& >>> .VueLive-error & >>> .VueLive-error
display none display none