Error encountered with the item properties in vue-simple-calendar 'classes'

For my Vue.js project, I am utilizing the npm calendar package called `vue-simple-calendar` and aiming to implement dynamic classes for each event item like background-color, etc. However, the `classes` property doesn't seem to be functioning as expected.

If you need more information, you can refer to: https://github.com/richardtallent/vue-simple-calendar#calendar-item-properties

To see a live demo, visit: (It appears to work fine in the demo)

Check out the implementation of the `classes` property in the demo App.vue file here: https://github.com/richardtallent/vue-simple-calendar-sample/blob/main/src/App.vue (`classes` property is successfully implemented there)

The `style` property seems to be functional, as shown below:

var app = new Vue({
        el: '#app',
        data: function() {
            return {
        showDate: new Date('10/15/2018'),
        events: [
          {
            startDate: '2018-10-06',
            endDate: '2018-10-13',
            title: 'Sample event 2',
            style: 'background-color: red'
          }
        ]
      }
        },
    component: {
        "calendar-view": window.CalendarView,  
    },
        methods: {
            setShowDate(d) {
                this.showDate = d;
            },
      onClickEvent() { alert('event clicked') }
        }
    })
#app {
        font-family: 'Avenir', Helvetica, Arial, sans-serif;
        color: #2c3e50;
        height: 67vh;
        width: 90vw;
        margin-left: auto;
        margin-right: auto;
    }
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2056554560120e150e1117">[email protected]</a>/dist/vue.js" ></script>
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="017774642c72686c716d642c62606d646f65607341352f302f31">[email protected]</a>/dist/CalendarView.umd.js" ></script>
<div id="app">
        <h1>My Calendar</h1>
        <calendar-view
            :show-date="showDate" :events="events" display-period-uom="month" :display-period-count="4"
            class="theme-default holiday-us-traditional holiday-us-official"
       @click-event="onClickEvent">
            <calendar-view-header
                slot="header"
                slot-scope="t"
                :header-props="t.headerProps"
                @input="setShowDate" />
        </calendar-view>
    </div>

On the flip side, it seems that the `classes` property is not working as intended:

var app = new Vue({
        el: '#app',
        data: function() {
            return {
        showDate: new Date('10/15/2018'),
        events: [
          {
            startDate: '2018-10-06',
            endDate: '2018-10-13',
            title: 'Sample event 2',
            classes: 'bg-red'
          }
        ]
      }
        },
    component: {
        "calendar-view": window.CalendarView,  
    },
        methods: {
            setShowDate(d) {
                this.showDate = d;
            },
      onClickEvent() { alert('event clicked') }
        }
    })
#app {
        font-family: 'Avenir', Helvetica, Arial, sans-serif;
        color: #2c3e50;
        height: 67vh;
        width: 90vw;
        margin-left: auto;
        margin-right: auto;
    }
.bg-red {
  background-color: red
}
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3c5c6d6f3819d869d8284">[email protected]</a>/dist/vue.js" ></script>
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3c4a4959114f55514c5059115f5d505952585d4e7c08120d120c">[email protected]</a>/dist/CalendarView.umd.js" ></script>
<div id="app">
        <h1>My Calendar</h1>
        <calendar-view
            :show-date="showDate" :events="events" display-period-uom="month" :display-period-count="4"
            class="theme-default holiday-us-traditional holiday-us-official"
       @click-event="onClickEvent">
            <calendar-view-header
                slot="header"
                slot-scope="t"
                :header-props="t.headerProps"
                @input="setShowDate" />
        </calendar-view>
    </div>

Answer №1

We have addressed an issue in the documentation and it has now been rectified! Please note that the classes property should be an array of strings, rather than just a single string. For example:

classes: ['bg-red']

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Update all Vue component imports to include the .vue extension at the end

The Vue CLI has decided to no longer support extensionless imports, causing compatibility issues with certain VS Code extensions like Vetur. In order to address this issue, I require all default component imports from a .vue file to include the file exten ...

Update the class of the panel immediately prior to a click event

Is it possible to change the class before the animation starts or when opening/closing the panel? Currently, the class only changes after the animation has finished and the panel is already open or closed. Here is an example: http://jsfiddle.net/0b9jppve/ ...

What could be causing my Next.js layout to re-render?

I currently have a basic root layout set up in Nextjs (app router) that displays a navigation bar and the child components underneath it. ROOT LAYOUT import "./globals.css"; import type { Metadata } from "next"; import { Inter } from & ...

Upon completing the build process, a blank white page appears when attempting to run it

I executed the yarn build command and received the dist folder. However, when I run the index.html, I encounter a blank white page. Directory Structure:- :~/Desktop/web$ ls babel.config.js docs node_modules public src yarn.lock ...

Emphasize the designated drop zone in Dragula

Incorporating the Dragula package into my Angular 2 project has greatly enhanced the drag-and-drop functionality. Bundling this feature has been a seamless experience. Visit the ng2-dragula GitHub page for more information. Although the drag-and-drop fun ...

Encountering a 404 error when using Vue history mode in conjunction with an Express

I'm facing an issue with my Vue SPA hosted on an Express server. Whenever I use history mode and refresh the page, I encounter a 404 not found exception. I attempted to solve this problem by utilizing the connect-history-api-fallback package but unfor ...

Learn how to incorporate a click event with the <nuxt-img> component in Vue

I am encountering an issue in my vue-app where I need to make a <nuxt-img /> clickable. I attempted to achieve this by using the following code: <nuxt-img :src="image.src" @click="isClickable ? doSomeStuff : null" /> Howeve ...

The absence of FormData.entries in submit is a limitation of the Vue framework

I recently created a Vue-App that consists of a simple form with just one <input name"surname"> and a <button type="submit">. The use case is to input "myname" and submit the form. However, when I initialize new FormData( ...

Is it necessary to convert SCSS into CSS in React?

I have a query about whether it is necessary to first compile our scss files into css and then import the css files into our react components, or if we can simply import the scss directly into the components? I've successfully imported scss directly ...

The animation functionality for Ionic Vue Router on iOS seems to be malfunctioning

I have recently set up a new Ionic Vue app using the tabs template and encountered an issue after switching the mode to ios - the routing animations disappeared. The animations work fine with md. This is what my index.html looks like: <!DOCTYPE html> ...

The animated loading image is taking an eternity to actually load

My website is loaded with heavy front-end features and I'm using a loading gif to help with the loading process. However, I've noticed that in Safari, there is a delay before the gif loads after the background does, which takes away from the inte ...

Using Vue.js to create dynamic routes that fetch and utilize a unique parameter ID

user/index.vue <tbody> <tr v-for="item in items" :key="item.id" > <td v-if="false" v-text="item.id" /> <td v-text="item.name" /> ...

npm fails to function properly following the execution of the 'npm install' command

After downloading and installing node.js + npm from https://nodejs.org/en/, I created a project folder and navigated into it on Windows 10. However, when I attempted to run the command: C:\nodejs\demo>npm install <a href="/cdn-cgi/l/email- ...

Creating Header Images for Websites, like the way Facebook does

Exploring how to properly configure the header image on my website has been intriguing. The main issue is that when I view it on my laptop, which has a width resolution of around 1280px, the header image's width measures about 2000px. My goal is to h ...

What is the significance of a colon appearing at the start of HTML attribute names in a Vue template?

<circle r="3" :cx="airport.x" :cy="airport.y" class="airport__marker" /> Are the attributes v-bind:cx and v-bind:cy equivalent to what is shown above? ...

Effortlessly Retrieve Initial Data from Ajax in Vue3 using Composition API

After extensively researching different approaches, I am leaning towards using the Vue3 composition API in its "setup" form for future compatibility. However, I am encountering a significant amount of variability across these approaches. My current form i ...

Delaying CSS Keyframe animations

I'm having trouble getting the color squares in my table to appear one by one. I want each color to show up, then disappear, followed by the next color appearing and disappearing, creating a light sequence effect. Any advice or assistance would be gre ...

The Angulajrjs popup timepicker is not located within the input row

Currently, I am working on creating a popup timepicker within a modal. My main goal is to have the button inside the input field rather than after it. Does anyone know how I can achieve this? Thank you. If you need more context, you can check out my plun ...

What is the best way to center align my button using CSS?

I'm struggling with aligning this button in CSS to the center: .btn { background-color: #44c767; -moz-border-radius: 28px; -webkit-border-radius: 28px; border-radius: 28px; border: 1px solid #18ab29; display: inline-block; cursor: poi ...

Am I on the right track with my code?

Is the code I've written sufficient to position text above an image? It resembles the orange "Ask Question" button on StackOverflow, but without being a clickable button or link. The text is surrounded by an orange color and it works fine, but I' ...