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

I want to bind html as vue-component #59

Open
kunJuly opened this issue Jun 12, 2019 · 4 comments
Open

I want to bind html as vue-component #59

kunJuly opened this issue Jun 12, 2019 · 4 comments

Comments

@kunJuly
Copy link

kunJuly commented Jun 12, 2019

like this
this.$swal({
type: 'success',
target: document.getElementsByClassName('live-left')[0],
// text: 'hellllllll',
html: <PopupWindow></PopupWindow>
})

PopupWindow is my component

Can I do that?thank~!

@panudetjt
Copy link

panudetjt commented Jun 21, 2019

I want a solution to this problem either.
After I googling it I found the solution it's work if we don't use this package like in this fiddle

but If we use this package in the swal content we will get this

<!--function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }-->

Why does that happen?

ref: https://stackoverflow.com/questions/48683390/using-vue-component-in-sweetalert2-content

@fahmizulhasymi
Copy link

After some digging, i found related post to the stackoverflow link from @panudetjt

for my case, i need to create interactive Vue Form. and i use this package so much in my apps.

This is what i came up with.
live sample here

i create component Instances programmatically, and mount it everytime i need the form (in case there is some preprocess). and get form result before i destroy it.

ref:
v-model on component

@LeonAlvarez
Copy link

After some digging, i found related post to the stackoverflow link from @panudetjt

for my case, i need to create interactive Vue Form. and i use this package so much in my apps.

This is what i came up with.
live sample here

i create component Instances programmatically, and mount it everytime i need the form (in case there is some preprocess). and get form result before i destroy it.

ref:
v-model on component

The problem with that solution is that it will be another Vue instance so, if you are using for example vuex you won't have access to it there

@fahmizulhasymi
Copy link

yes, that is why i use function initForm and getResult as the bridge.

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