Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support custom display placeholder content #160

Merged
merged 1 commit into from
Sep 24, 2023

Conversation

hehehai
Copy link
Contributor

@hehehai hehehai commented Sep 22, 2023

Background

In the environment of poor network, loading cdn script and initializing preview will be blank for a long time.

image

Solution

Implement custom loading animation for the initial placeholder content of iframe

() =>
      h(Repl, {
       	...
        previewOptions: {
          placeholderHTML: ` <style>
      html, body {
        width: 100%;
        height: 100%;
      }
      body, html {
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .loading {
        font-size: 20px;
      }
    </style>
    <div class="loading">Loading...</div>`
        }
      })
image

@vercel
Copy link

vercel bot commented Sep 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
repl ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 22, 2023 2:01pm

@sxzz sxzz changed the title feat: support display placeholder content before preview rendered feat: support custom display placeholder content Sep 24, 2023
@sxzz sxzz merged commit 9ca27a1 into vuejs:main Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants