vue-sweetalert2 icon indicating copy to clipboard operation
vue-sweetalert2 copied to clipboard

I want to bind html as vue-component

Open kunJuly opened this issue 5 years ago • 4 comments

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~!

kunJuly avatar Jun 12 '19 02:06 kunJuly

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

panudetjt avatar Jun 21 '19 00:06 panudetjt

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

fahmizulhasymi avatar Aug 17 '19 04:08 fahmizulhasymi

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

LeonAlvarez avatar Nov 29 '19 11:11 LeonAlvarez

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

fahmizulhasymi avatar Nov 29 '19 13:11 fahmizulhasymi