Search results

Getting started with Vue Skeleton component

25 Jan 2023 / 2 minutes to read

This section explains how to create a simple Skeleton, and configure its available functionalities in Vue using Vue quickstart seed repository.

Prerequisites

System requirements for Syncfusion Vue UI components

Dependencies

The following list of dependencies are required to use the Skeleton component in your application.

Copied to clipboard
|-- @syncfusion/ej2-vue-notifications
    |-- @syncfusion/ej2-vue-base
    |-- @syncfusion/ej2-base
    |-- @syncfusion/ej2-notifications

Installation and configuration

You can use Vue CLI to setup your vue applications. To install Vue CLI use the following command.

Copied to clipboard
npm install -g @vue/cli

npm install -g @vue/cli-init

Start a new project using below Vue CLI command.

Copied to clipboard
vue init webpack-simple quickstart

cd quickstart

npm install

Install Syncfusion Skeleton packages using below command.

Copied to clipboard
npm install @syncfusion/ej2-vue-notifications --save

Registering Skeleton component using Vue.use()

Import the Skeleton Plugin from the Essential JS 2 Vue package and register the same using Vue.use() with Component Plugin as its argument.

Refer to the code snippet given below.

Copied to clipboard
import Vue from 'vue';
import { SkeletonPlugin } from "@syncfusion/ej2-vue-notifications";

Vue.use(SkeletonPlugin);

export default {}

By registering component plugin in Vue, all child directives are also globally registered. We can also use Vue.Component() to register Skeleton. Refer here to know more about component registration.

Initialize Skeleton

Add the EJ2 Vue Skeleton using <ejs-skeleton> to the <template> section of the App.vue file in src directory.

Copied to clipboard
<template>
    <div>
        <ejs-skeleton height='15px'></ejs-skeleton>
    </div>
</template>

<script>
    import Vue from 'vue';
    import { SkeletonPlugin } from "@syncfusion/ej2-vue-notifications";

    Vue.use(SkeletonPlugin);

    export default {
        data: function () {
            return {};
        }
    }
</script>

<style>
    @import "../node_modules/@syncfusion/ej2-base/styles/material.css";
    @import "../node_modules/@syncfusion/ej2-notifications/styles/material.css";
</style>

Run the application

Now run the npm run dev command in the console, it will build your application and open in the browser.

The following example shows a basic Skeleton component.

Source
Preview
app.vue
Copied to clipboard
<template>
    <div>
        <ejs-skeleton height='15px'></ejs-skeleton>
    </div>
</template>

<script>
    import Vue from 'vue';
    import { SkeletonPlugin } from "@syncfusion/ej2-vue-notifications";

    Vue.use(SkeletonPlugin);

    export default {
        data: function () {
            return {};
        }
    }
</script>

<style>
    @import "../node_modules/@syncfusion/ej2-base/styles/material.css";
    @import "../node_modules/@syncfusion/ej2-notifications/styles/material.css";
</style>