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

Updates and fixes for vue 3 #1

Open
wants to merge 2 commits into
base: vue-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"presets": ["@babel/env"]
}
"presets": [
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure why I needed to do this, but the ES6 style import statements were complaining about not being able to find a default export, until I made this change.

[
"@babel/preset-env",
{
"modules": false
}
]
]
}
20 changes: 10 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { h } from 'vue';

const SDK_VERSION = "1.0.1";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to bump this a major version? (Maybe 3 to match Vue?)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good catch, forgot to bump it.


const PayloadType = {
Expand Down Expand Up @@ -155,12 +157,12 @@ export default {
window.removeEventListener("message", this.handleMessage);
}
},
render(createElement) {
render() {
if (!this.show) {
return;
}

const iframe = createElement("iframe", {
const iframe = h("iframe", {
key: this.idx,
style: {
height: `${this.height}px`,
Expand All @@ -172,16 +174,14 @@ export default {
width: "100%",
overflow: "hidden",
},
attrs: {
src: this.frameUrl(),
allow: "camera",
scrolling: "no",
referrerpolicy: "no-referrer-when-downgrade",
},
src: this.frameUrl(),
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this was due to Vue2->Vue3, but with attrs as an object, it was appearing as attrs='[Object object]' on the iframe tag, rather than as the individual attributes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe related, but it looks like people were running into a similar issue with the vue router when upgrading 2 -> 3. Either way your fix seems like the way to go.

allow: "camera",
scrolling: "no",
referrerpolicy: "no-referrer-when-downgrade"
});

if (this.showInModal) {
return createElement(
return h(
"div",
{
style: {
Expand All @@ -197,7 +197,7 @@ export default {
},
},
[
createElement(
h(
"div",
{
style: {
Expand Down