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

vue-menu does not work on vue-electron #5

Closed
simdax opened this issue Feb 1, 2018 · 11 comments
Closed

vue-menu does not work on vue-electron #5

simdax opened this issue Feb 1, 2018 · 11 comments

Comments

@simdax
Copy link

simdax commented Feb 1, 2018

Hello

I'm using the window component, found it great, and trying using this one.
I'm trying to compile the simple example of the main page, with hsc-menu-bar/item
Unfortunatly, i got errors, like unfound components.
I'm working with an electron-vue template, and installing the plugin as usual
import * as VueMenu from '@hscmap/vue-menu' and Vue.use(VueMenu)
I have to use them all ?

[Vue warn]: Injection "menubar" not found

found in

---> <MenubaritemType> at src/menubaritem/index.vue
       <HscMenuStyleWhite>
         <MyMenu> at src/renderer/components/menu.vue
           <Mainview> at src/renderer/components/MainView.vue
             <Testclaudio> at src/renderer/App.vue
               <Root>
warn @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:576
resolveInject @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:3649
initInjections @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:3598
Vue._init @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:4555
MenubaritemType @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:4726
createComponentInstanceForVnode @ vue.esm.js?efeb:4242
init @ vue.esm.js?efeb:4059
createComponent @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:5510
createElm @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:5458
createChildren @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:5584
createElm @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:5486
patch @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:5993
Vue._update @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:2635
updateComponent @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:2763
get @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:3113
Watcher @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:3102
mountComponent @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:2770
Vue$3.$mount @ /Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:7893
init @ vue.esm.js?efeb:4065
createComponent @ vue.esm.js?efeb:5512
createElm @ vue.esm.js?efeb:5460
createChildren @ vue.esm.js?efeb:5586
createElm @ vue.esm.js?efeb:5488
patch @ vue.esm.js?efeb:5995
Vue._update @ vue.esm.js?efeb:2637
updateComponent @ vue.esm.js?efeb:2765
get @ vue.esm.js?efeb:3115
Watcher @ vue.esm.js?efeb:3104
mountComponent @ vue.esm.js?efeb:2772
Vue$3.$mount @ vue.esm.js?efeb:8429
Vue$3.$mount @ vue.esm.js?efeb:10790
init @ vue.esm.js?efeb:4065
createComponent @ vue.esm.js?efeb:5512
createElm @ vue.esm.js?efeb:5460
patch @ vue.esm.js?efeb:5995
Vue._update @ vue.esm.js?efeb:2637
updateComponent @ vue.esm.js?efeb:2765
get @ vue.esm.js?efeb:3115
Watcher @ vue.esm.js?efeb:3104
mountComponent @ vue.esm.js?efeb:2772
Vue$3.$mount @ vue.esm.js?efeb:8429
Vue$3.$mount @ vue.esm.js?efeb:10790
init @ vue.esm.js?efeb:4065
createComponent @ vue.esm.js?efeb:5512
createElm @ vue.esm.js?efeb:5460
createChildren @ vue.esm.js?efeb:5586
createElm @ vue.esm.js?efeb:5488
patch @ vue.esm.js?efeb:5995
Vue._update @ vue.esm.js?efeb:2637
updateComponent @ vue.esm.js?efeb:2765
get @ vue.esm.js?efeb:3115
Watcher @ vue.esm.js?efeb:3104
mountComponent @ vue.esm.js?efeb:2772
Vue$3.$mount @ vue.esm.js?efeb:8429
Vue$3.$mount @ vue.esm.js?efeb:10790
init @ vue.esm.js?efeb:4065
createComponent @ vue.esm.js?efeb:5512
createElm @ vue.esm.js?efeb:5460
createChildren @ vue.esm.js?efeb:5586
createElm @ vue.esm.js?efeb:5488
patch @ vue.esm.js?efeb:5995
Vue._update @ vue.esm.js?efeb:2637
updateComponent @ vue.esm.js?efeb:2765
get @ vue.esm.js?efeb:3115
Watcher @ vue.esm.js?efeb:3104
mountComponent @ vue.esm.js?efeb:2772
Vue$3.$mount @ vue.esm.js?efeb:8429
Vue$3.$mount @ vue.esm.js?efeb:10790
init @ vue.esm.js?efeb:4065
createComponent @ vue.esm.js?efeb:5512
createElm @ vue.esm.js?efeb:5460
patch @ vue.esm.js?efeb:6034
Vue._update @ vue.esm.js?efeb:2637
updateComponent @ vue.esm.js?efeb:2765
get @ vue.esm.js?efeb:3115
Watcher @ vue.esm.js?efeb:3104
mountComponent @ vue.esm.js?efeb:2772
Vue$3.$mount @ vue.esm.js?efeb:8429
Vue$3.$mount @ vue.esm.js?efeb:10790
(anonymous) @ main.js?3b76:23
(anonymous) @ renderer.js:908
__webpack_require__ @ renderer.js:680
fn @ renderer.js:90
(anonymous) @ renderer.js:825
__webpack_require__ @ renderer.js:680
(anonymous) @ renderer.js:726
(anonymous) @ renderer.js:729
4/Users/scornaz/audioClaudio/node_modules/vue/dist/vue.runtime.common.js:576 [Vue warn]: Injection "parentMenu" not found

found in

---> <MenuitemType> at src/menuitem/index.vue
       <HscMenuStyleWhite>
         <MyMenu> at src/renderer/components/menu.vue
           <Mainview> at src/renderer/components/MainView.vue
             <Testclaudio> at src/renderer/App.vue
               <Root>
@michitaro
Copy link
Owner

"hsc-menu-bar-item" must be in "hsc-menu-bar" like this

@michitaro
Copy link
Owner

Doesn't it work?
I mean
OK:

    <hsc-menu-style-white>
        <hsc-menu-bar style="border-radius: 0 0 4pt 0;">
            <hsc-menu-bar-item label="File">
        </hsc-menu-bar>
    </hsc-menu-style-white>

NG:

    <hsc-menu-style-white>
        <hsc-menu-bar-item label="File">
    </hsc-menu-style-white>

@simdax
Copy link
Author

simdax commented Feb 6, 2018

No, it still does not work, I was using the main example

 <template>
    <hsc-menu-style-white>
        <hsc-menu-bar style="border-radius: 0 0 4pt 0;">
            <hsc-menu-bar-item label="File">
                <hsc-menu-item label="New" @click="window.alert('New')" />
                <hsc-menu-item label="Open" @click="window.alert('Open')" />
                <hsc-menu-separator/>
                <hsc-menu-item label="Save" @click="window.alert('Save')" :disabled="true" />
                <hsc-menu-item label="Export to">
                    <hsc-menu-item label="PDF" />
                    <hsc-menu-item label="HTML" />
                </hsc-menu-item>
            </hsc-menu-bar-item>
            <hsc-menu-bar-item label="Edit">
                <hsc-menu-item label="Undo" keybind="meta+z" @click="window.alert('Undo')" />
                <hsc-menu-separator/>
                <hsc-menu-item label="Cut" keybind="meta+x" @click="window.alert('Cut')" />
                <hsc-menu-item label="Copy" keybind="meta+c" @click="window.alert('Copy')" />
                <hsc-menu-item label="Paste" keybind="meta+v" @click="window.alert('Paste')" :disabled="true" />
            </hsc-menu-bar-item>
        </hsc-menu-bar>
    </hsc-menu-style-white>
</template>

@michitaro
Copy link
Owner

I see. The same problem occurred on my vue-electron environment too. I'll fix them.

@michitaro
Copy link
Owner

I was looking into the issue, but have found no solution for now.
It seems that these problems are caused by differences between browser and electron-environment.

@bdsoha
Copy link

bdsoha commented Dec 2, 2018

Any updates on this issue. I love your package and want to use it with electron

@gaodeng
Copy link

gaodeng commented Dec 10, 2018

any news on this?

@michitaro michitaro changed the title missing deps vue-menu does not work on vue-electron Dec 10, 2018
@michitaro
Copy link
Owner

I'm sorry that I have no idea about this.

@gaodeng
Copy link

gaodeng commented Jan 2, 2019

@michitaro I don't no why,but add @hscmap/vue-menu to whitelist in webpack.renderer.config.js ,can workaroud this error.

let whiteListedModules = ['vue','element-ui','@hscmap/vue-menu']

@bdsoha
Copy link

bdsoha commented Jan 2, 2019

Works like a charm

michitaro added a commit that referenced this issue Jan 4, 2019
@michitaro
Copy link
Owner

@gaodeng Thank you very much for the suggestion!
I've confirmed that your suggestion solves the problem. I've updated the README to refer your suggestion.

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

No branches or pull requests

4 participants