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

Not working with Vue component #26

Open
ultrageek opened this issue Aug 26, 2020 · 5 comments
Open

Not working with Vue component #26

ultrageek opened this issue Aug 26, 2020 · 5 comments

Comments

@ultrageek
Copy link

ultrageek commented Aug 26, 2020

Apologies if this is not a bug:

The code works fine in Chrome for me, on a localhost server, unless I try to integrate it into a Vue application. I use Vue with a CDN, with HTML and JS separated. I get "Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option."

I tried adding 'x-frame-bypass' : xframe to my Vue's components list, which throws an error about "xframe'. I then replaced xframe with iframe, but the same type of error shows up. I also embedded x-frame-bypass.js into my own Vue app's JS file, etc. But either my Vue code works and X-Frame-Bypass doesn't, or vice versa.

Now here's the weird thing. At the moment, I have the following situation:

  1. Chrome browser (fairly recent): Vue code works, xframe works but won't display due to the aforementioned complaint.
  2. Firefox browser: Vue code doesn't work, xframe displays fine
  3. Stack (Chromium) browser: same as with Firefox

Unfortunately, I don't know enough about extending elements to know if this is actually a bug or just appears to be. So apologies in advance

@realrecordzLab
Copy link

Same problem in my vue app. I've installed the library using vue ui and imported it in my vue app main.js entry point but with no success

@realrecordzLab
Copy link

@ultrageek try this vue directive I've made to make the library work in vue.

@ultrageek
Copy link
Author

Nice, thanks! I ended up tossing xframebypass and used Vue's @click on text to load my iframe with the necessary URL. This is only a hack, but the URLs I need don't seem to have a cross-domain issue.

@realrecordzLab
Copy link

Nice, thanks! I ended up tossing xframebypass and used Vue's @click on text to load my iframe with the necessary URL. This is only a hack, but the URLs I need don't seem to have a cross-domain issue.

You are welcome! Feel free to download and use it in your projects

@bigWillow
Copy link

bigWillow commented Aug 24, 2022

<template> <div v-html="iframeHtml" :class="[ iframeBoxClass]"> </div> </template>

`<script>
import './custom-elements-builtin@0.6.5.js'
import './x-frame-bypass.js'

export default {
data() {
return {
iframeHtml: '',
src: '', //iframe src
iframeClass: '', //ifame css
iframeBoxClass: '' //iframe box css
}
},
mounted(){
this.initBypass()
},
methods: {
// 初始化Bypass
initBypass() {
const {src, iframeClass} = this
this.iframeHtml = <iframe frameborder="0" src="${src}" class="${iframeClass || ''}" is="x-frame-bypass"> </iframe>

	}
}

}
</script>`

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

3 participants