如何使用 Vue Js 自定义全日历?

How to custom fullcalendar using Vue Js?

问题:

我在自定义 完整日历视图 时遇到问题。

我想做的事情:

我想将默认视图设置为 。 但是,我可以使用 JQuery 来做到这一点,但我想知道如何使用 Vue-js 来做同样的事情?

我的研究成果:

我的JQuery代码

$(document).ready(function() {
  $("#calendar").fullCalendar("changeView", "month");
});

我的Vue.js代码

export default {
  data() {
    return {
      eventSources: [
        {
          events(start, end, timezone, callback) {
            axios.get("http://localhost:8000/api/events").then(response => {
              callback(response.data.data);
            });
          },
          color: "yellow",
          textColor: "black",
        }
      ]
    };
  }
};

如何通过 Vue.js 代码实现与使用 Jquery 相同的功能?

你可以试试:defaultView: 'month'

你的观点应该是这样的:

<full-calendar :config="calendarConfig"/>

并且在您的 data 中您需要设置您的配置:

data () {
      return {
         calendarConfig: {
            defaultView: 'month'
         }
    }
}

备注

如果您正在使用 v4,则可以 check doc