Coder Social home page Coder Social logo

Comments (6)

geek-yang avatar geek-yang commented on August 17, 2024

Regarding the placeholder for unavailable figures, after some googling, it seems that an easy and clean solution will be the @error handler in nuxt, see the post. However, it does not work in our case. I tried most of the suggested solutions I could find (e.g. like this, and the other post). Still did not get anything working for me.

from atlas.

geek-yang avatar geek-yang commented on August 17, 2024

An alternative would be, load image via computed property and use if/else pair in the computed: {} function. But it is a bit nasty.

from atlas.

geek-yang avatar geek-yang commented on August 17, 2024

One more idea, we can place the img inside the div. Set the div background to be the placeholder image using css. And move all the figures from assets to static (which means, we do not load figures dynamically via webpack, but statically). Then, when the images are missing, it only returns an error in the console, but the page is still there, which will display nothing but shows the background.

Again, just some thought, but the solution is still not perfect. We have to discuss it a bit.

from atlas.

Peter9192 avatar Peter9192 commented on August 17, 2024

What happened to the idea we started off with, adding a callback to update the figure when the selection was changed? Why did it not work?

from atlas.

Peter9192 avatar Peter9192 commented on August 17, 2024

And move all the figures from assets to static (which means, we do not load figures dynamically via webpack, but statically)

Probably fine, but not sure it's needed.

One more idea, we can place the img inside the div

We used to have that before, but we changed to a div with background image because it was easier to get the responsive stretching right.

from atlas.

geek-yang avatar geek-yang commented on August 17, 2024

@Peter9192 Your solution #22 looks very good to me. Indeed my attempt was to use the error event handler and place the fallback there. But the nuxt option (@error) does not work for no reason. But your code simply does what I want. I will stick to it instead. Thanks for the solution!

from atlas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.