Javascript Vue fullcalendar,打开。事件点击时的模态
我使用Vue FullCalendar成功地获得了事件单击功能,但我正在尝试使用该跳板,并在单击事件时使其打开一个模式 我现在得到的是未定义showModal的Javascript Vue fullcalendar,打开。事件点击时的模态,javascript,vue.js,Javascript,Vue.js,我使用Vue FullCalendar成功地获得了事件单击功能,但我正在尝试使用该跳板,并在单击事件时使其打开一个模式 我现在得到的是未定义showModal的 我哪里出了问题 <FullCalendar @eventClick="eventClick" /> <script type="text/x-template" id="modal-template"> <transition name="modal">
我哪里出了问题
<FullCalendar
@eventClick="eventClick"
/>
<script type="text/x-template" id="modal-template">
<transition name="modal">
<div class="modal-mask">
<div class="modal-wrapper">
<div class="modal-container">
<div class="modal-header">
<slot name="header">
default header
</slot>
</div>
<div class="modal-body">
<slot name="body">
default body
</slot>
</div>
<div class="modal-footer">
<slot name="footer">
default footer
<button class="modal-default-button" @click="$emit('close')">
OK
</button>
</slot>
</div>
</div>
</div>
</div>
</transition>
</script>
<modal v-if="showModal" @close="showModal = false">
<!--
you can use custom content here to overwrite
default content
-->
<h3 slot="header">custom header</h3>
</modal>
<script>
Vue.component('modal', {
template: '#modal-template'
})
export default {
data () {
return {
events: [
],
showModal: false
}
},
Methods:{
eventClick: function(e) {
var eventObj = e.event;
showModal = true;
//alert('Clicked ' + eventObj.title);
let element = this.$refs.modal.$el;
$(element).modal('show');
}
},
</script>
默认标题
默认主体
默认页脚
好啊
自定义标题
Vue.组件('模态'{
模板:“#模式模板”
})
导出默认值{
数据(){
返回{
活动:[
],
showModal:错误
}
},
方法:{
事件单击:函数(e){
var eventObj=e.event;
showModal=true;
//警报('单击'+事件对象标题);
设元素=此。$refs.modal。$el;
$(元素).modal('show');
}
},
以下是脚本部分的简化版本:
导出默认值{
数据(){
返回{
showModal:错,
};
},
方法:{
eventClick(){
this.showModal=true;
},
},
};
主要变化:
方法
而不是方法
this.showModal
而不是showModal
以下是脚本部分的简化版本:
导出默认值{
数据(){
返回{
showModal:错,
};
},
方法:{
eventClick(){
this.showModal=true;
},
},
};
主要变化:
方法
而不是方法
this.showModal
而不是showModal
你能分享一个你正在使用的插件的链接吗?另外,eventClick是一种方法,所以你必须在“方法”中写入该块Vue js类文件中的对象。它在方法中,但出于某种原因我没有复制它。它是@fullcalendar/vuethis.showmodel=truen您可以共享一个链接,您正使用哪个插件吗?另外,eventClick是方法,所以您必须在“方法”中写入该块Vue js类文件中的对象。它在方法中,但出于某种原因我没有复制它。它是@fullcalendar/vuethis.showmodel=true