Deluze / electron-vue-template

Simple Vue3 + Electron starter template in TypeScript, including ViteJS and Electron Builder
MIT License
534 stars 104 forks source link

How to integrate Element-Plus or View-UI-Plus framework for this template? #31

Closed PublicWorld closed 1 year ago

PublicWorld commented 1 year ago

Hi Deluze, I like your template very much, and I want to use any of the following UI frameworks to integrate into this template, but I have been in contact with vue and electron for a short time, and I encountered various intractable errors when trying to integrate, which made me unable to continue. So I would like to ask you, is it possible to integrate any of these frameworks into our template? Because these two UI frameworks are very beautiful and easy to use, the integration can help us complete the development work more quickly and efficiently. Thanks again!

View-UI-Plus: https://github.com/view-design/ViewUIPlus (old version -> ViewUI: https://github.com/view-design/ViewUI) Element-Plus: https://github.com/element-plus/element-plus

Deluze commented 1 year ago

Can you describe the issues you're running in to? Theoretically the renderer part of this template is a usual Vue3 app, so there shouldn't be any problems integrating any Vue libraries

PublicWorld commented 1 year ago

As you can see, when I try to load the macOS local image and show it, I encountered this issue(his src is always [Object object]). The image could not be displayed and rendered correctly. I looked up a lot of information but could not solve it.

image image image

This is my dependencies.

    "dependencies": {
        "axios": "^0.24.0",
        "canvas-confetti": "^1.4.0",
        "electron-store": "^8.0.1",
        "fs-extra": "^10.0.0",
        "gifsicle": "5.3.0",
        "junk": "^3.1.0",
        "mime-types": "^2.1.34",
        "pinia": "^2.0.9",
        "queue": "^6.0.2",
        "view-ui-plus": "^1.3.1",
        "vue": "^3.2.26",
        "vue-router": "^4.0.12"
    },
Deluze commented 1 year ago

Well, you are passing down an object to attrs, see:

attrs: {
  src: path,
}

Since you're using Vue's hyperscript you can pass down the src without wrapping it in attrs, see:

h('img', { src: '/myImage.png' });

I'm not sure where you got the attrs object from, but this sould set the src attribute correctly.

PublicWorld commented 1 year ago

Yes, you are right! Thanks Bro!