Code Monkey home page Code Monkey logo

Comments (8)

Equanox avatar Equanox commented on September 24, 2024

To use a image it must be included in the directory given to gotron.New("webapp") and referenced using a relative path to webapp. Everything in webapp is exposed by a fileserver when given to electron.

webapp/
  img/
    img.png
  index.html

In index.html (or some imported js code) reference your img like this..

 <img src="img/img.png"></img>

If you are using example/main.go put your image inside example/ui/build or use your own directory containing your application.

from gotron.

rafaelgfirmino avatar rafaelgfirmino commented on September 24, 2024

I'm Using vuecli3 when I put in my components in src/views/Home.vue I can't call the images using this annotations

<img alt="Vue logo" src="@/assets/logo.png"> don't work
<img alt="Vue logo" src="../assets/logo.png"> don't work 

But if I put the image in src/app.vue using this form import it's work

<img alt="Vue logo" src="@/assets/logo.png"> work
<img alt="Vue logo" src="../assets/logo.png">  work 

from gotron.

Equanox avatar Equanox commented on September 24, 2024

I'm not too familiar with vue. Guess this related to the way you build your project? Are other components in Home.vue displayed correctly?

Can provide a complete example?

from gotron.

rafaelgfirmino avatar rafaelgfirmino commented on September 24, 2024

Guess this related to the way you build your project?
Yes, but in pure vue it's work
Are other components in Home.vue displayed correctly?
Yes, other things running correctly
Can provide a complete example?
https://github.com/rafaelgfirmino/gotron-vue

You can see the file src/App.vue where I call the image and it come correctly.
The problem is when I call the image in src/components/Home.vue.

from gotron.

puengel avatar puengel commented on September 24, 2024

I just took your example and followed the steps you provided. This is what I see after running go run main.go:

image

from gotron.

rafaelgfirmino avatar rafaelgfirmino commented on September 24, 2024

Sorry, @puengel you need click in home for where is the wrong image.

from gotron.

puengel avatar puengel commented on September 24, 2024

Hey @rafaelgfirmino , I found the cause of your problem.
https://github.com/rafaelgfirmino/gotron-vue/blob/master/src/router.js line 8:
mode: 'home',
should not be used in electron apps. If you remove this line your code works just fine.
grafik

Closing this issue as it is not a gotron issue.

from gotron.

rafaelgfirmino avatar rafaelgfirmino commented on September 24, 2024

Thanks man !

from gotron.

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.