[英]Can't Run Vue Js Method from SweetAlert2 Pop up
I have this vue js app with a pop up using SweetAlert2.我有一个使用 SweetAlert2 弹出的 vue js 应用程序。 There a link in the pop up message that needs to call a vue js method.
弹出消息中有一个链接需要调用vue js方法。 But, i can't get it to work.
但是,我无法让它工作。
<template>
<button @click="popModal()">Alert</button>
</template>
export default {
data(){
return{
popMessage: "<h5>Title</h5>
<p>I'm trying to call a vue js method on this link <a href='https://www.google.com' target='_blank' id='popLink' @click='run Method()'>google.com</a>. </p>"
}
},
methods: {
popModal(){
this.$fire({
html: message,
showCancelButton: false
})
},
runMethod(){
console.log("Link in pop up!");
}
}
}
I'm guessing:我正在猜测:
$fire
to your app.$fire
的全局方法。 If the above guesses are true, there are only two problems:如果以上猜测都是真的,那么只有两个问题:
popMessage
in data
contains line breaks, which break compilation. data
中的popMessage
包含换行符,这会中断编译。 Either replace the double quotes (") with back-ticks (`), which will preserve the line breaks, or place each line inside double quotes and concatenate them.message
is undefined
. message
undefined
。 Did you mean this.popMessage
?this.popMessage
吗?this.$fire({
html: this.popMessage,
showCancelButton: false
})
Side notes :旁注:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.