2019-05-21 12:06:16 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div class="content-section documentation">
|
2020-10-11 19:26:13 +00:00
|
|
|
<Message severity="warn">This guide is for Vue 3 and PrimeVue 3, visit <a href="https://www.primefaces.org/primevue/showcase-v2">PrimeVue 2.x website</a> if you are using Vue 2.</Message>
|
2020-09-26 09:57:15 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h1>Setup</h1>
|
|
|
|
<p>PrimeVue is a rich set of open source native components for Vue.</p>
|
|
|
|
|
2020-12-12 09:19:49 +00:00
|
|
|
<h5>Video Tutorial</h5>
|
|
|
|
<p>Watch the video tutorial that goes through the steps documented on this guide.</p>
|
|
|
|
<div class="video-container">
|
|
|
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/cGTXuyqIwMA" frameborder="0" allowfullscreen></iframe>
|
|
|
|
</div>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Download</h5>
|
2020-07-23 08:47:22 +00:00
|
|
|
<p>PrimeVue is available at <a href="https://www.npmjs.com/package/primevue">npm</a>, if you have an existing application run the following commands to download PrimeVue and PrimeIcons to your project.</p>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2020-12-12 09:19:49 +00:00
|
|
|
npm install primevue@^3.1.1 --save
|
2019-05-21 12:06:16 +00:00
|
|
|
npm install primeicons --save
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2020-07-02 15:08:08 +00:00
|
|
|
|
|
|
|
<h5>PrimeFlex</h5>
|
|
|
|
<p>PrimeFlex is a CSS utility library featuring various helpers such as a grid system, flexbox, spacing, elevation and more. Although it is not required, it is highly
|
2020-09-08 10:47:51 +00:00
|
|
|
recommended to add PrimeFlex as it is likely to need such utilities when developing applications. View the <router-link to="/primeflex">PrimeFlex</router-link> section for the installation.</p>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Module Loader</h5>
|
2020-12-09 12:33:47 +00:00
|
|
|
<p>This is the recommended way if your application uses <a href="https://cli.vuejs.org/">vue-cli</a> or has a webpack based build with <a href="https://github.com/vuejs/vue-loader">vue-loader</a> configured.</p>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
<p>Begin with installing PrimeVue with the <i>use</i> function.</p>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2020-12-09 12:33:47 +00:00
|
|
|
import {createApp} from 'vue';
|
|
|
|
import PrimeVue from 'primevue/config';
|
|
|
|
const app = createApp(App);
|
2020-09-24 11:14:55 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
app.use(PrimeVue);
|
2020-12-09 12:35:29 +00:00
|
|
|
|
2020-09-24 11:14:55 +00:00
|
|
|
</code></pre>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
<p>Then import the component you need and registering it so that you'll be able to utilize the component in your application.</p>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2020-09-26 09:57:15 +00:00
|
|
|
import {createApp} from 'vue';
|
2020-12-09 12:33:47 +00:00
|
|
|
import PrimeVue from 'primevue/config';
|
|
|
|
import Dialog from 'primevue/dialog';
|
2020-09-26 09:57:15 +00:00
|
|
|
const app = createApp(App);
|
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
app.use(PrimeVue);
|
2020-09-24 11:14:55 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
app.component('Dialog', Dialog);
|
2020-12-09 12:35:29 +00:00
|
|
|
|
2020-09-24 11:14:55 +00:00
|
|
|
</code></pre>
|
2019-05-24 11:10:45 +00:00
|
|
|
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code>
|
|
|
|
<code>
|
2019-05-27 09:56:40 +00:00
|
|
|
<Dialog></Dialog>
|
2020-09-24 11:14:55 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
</code></pre>
|
2019-05-27 09:56:40 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Script Tag</h5>
|
2019-05-27 09:56:40 +00:00
|
|
|
<p>Other alternative is utilizing the components directly within the browser with UMD packages.</p>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code>
|
|
|
|
<code>
|
2019-05-27 09:56:40 +00:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>calendar demo</title>
|
2020-05-13 14:54:04 +00:00
|
|
|
<link href="https://unpkg.com/primevue/resources/themes/saga-blue/theme.css " rel="stylesheet">
|
2019-05-30 13:45:06 +00:00
|
|
|
<link href="https://unpkg.com/primevue/resources/primevue.min.css " rel="stylesheet">
|
|
|
|
<link href="https://unpkg.com/primeicons/primeicons.css " rel="stylesheet">
|
2020-11-09 11:38:37 +00:00
|
|
|
<script src="https://unpkg.com/vue@next"></script>
|
2019-05-30 13:45:06 +00:00
|
|
|
<script src="https://unpkg.com/primevue/components/calendar/calendar.umd.min.js"></script>
|
2019-05-27 09:56:40 +00:00
|
|
|
|
|
|
|
<div id="app">
|
|
|
|
<p-calendar></p-calendar>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
2020-11-09 11:38:37 +00:00
|
|
|
Vue.createApp({
|
2019-05-27 09:56:40 +00:00
|
|
|
components: {
|
|
|
|
'p-calendar': calendar
|
|
|
|
}
|
2020-11-09 11:38:37 +00:00
|
|
|
}).mount('#app')
|
2019-05-27 09:56:40 +00:00
|
|
|
</script>
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2019-05-27 09:56:40 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Dependencies</h5>
|
2019-05-27 09:56:40 +00:00
|
|
|
<p>Majority of PrimeVue components (95%) are native and there are some exceptions having 3rd party dependencies such as Quill for Editor.</p>
|
2019-05-21 12:06:16 +00:00
|
|
|
<p>In addition, components require PrimeIcons library for icons.</p>
|
|
|
|
|
2020-09-26 09:57:15 +00:00
|
|
|
<h6>Mandatory</h6>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2019-05-21 12:06:16 +00:00
|
|
|
dependencies: {
|
2020-09-26 09:57:15 +00:00
|
|
|
"vue": "^3.0.0",
|
2020-05-28 14:17:00 +00:00
|
|
|
"primeicons": "^4.0.0"
|
2019-05-21 12:06:16 +00:00
|
|
|
}
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-09-26 09:57:15 +00:00
|
|
|
<h6>Optional</h6>
|
2019-05-21 12:06:16 +00:00
|
|
|
<p>Here is the list of components with 3rd party dependencies.</p>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Component</th>
|
|
|
|
<th>Dependency</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>Charts</td>
|
|
|
|
<td>Charts.js 2.1.x+</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>Editor</td>
|
|
|
|
<td>Quill.js 1.3.3+</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>FullCalendar</td>
|
2020-12-09 15:04:06 +00:00
|
|
|
<td>FullCalendar 5.4.0+.</td>
|
2019-05-21 12:06:16 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>PrimeFlex</td>
|
2019-05-27 09:56:40 +00:00
|
|
|
<td>DataView</td>
|
2019-05-21 12:06:16 +00:00
|
|
|
</tr>
|
2020-09-23 11:56:24 +00:00
|
|
|
<tr>
|
|
|
|
<td>Toast and Terminal</td>
|
2020-10-22 11:53:35 +00:00
|
|
|
<td>Mitt</td>
|
2020-09-23 11:56:24 +00:00
|
|
|
</tr>
|
2019-05-21 12:06:16 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2019-10-01 13:00:26 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Styles</h5>
|
2019-10-01 13:00:26 +00:00
|
|
|
<p>The css dependencies are as follows, note that you may change the theme with another one of your choice. If you are using a bundler such as webpack with a css loader you
|
2019-05-21 12:06:16 +00:00
|
|
|
may import them to your main application component.</p>
|
2019-10-01 13:00:26 +00:00
|
|
|
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2020-05-13 14:54:04 +00:00
|
|
|
primevue/resources/themes/saga-blue/theme.css //theme
|
|
|
|
primevue/resources/primevue.min.css //core css
|
2019-05-27 09:56:40 +00:00
|
|
|
primeicons/primeicons.css //icons
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2020-05-13 14:54:04 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Free Themes</h5>
|
2020-10-10 10:29:34 +00:00
|
|
|
<p>PrimeVue ships with various free themes to choose from.</p>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.css>
|
|
|
|
<code>
|
2020-06-26 13:37:03 +00:00
|
|
|
primevue/resources/themes/bootstrap4-light-blue/theme.css
|
|
|
|
primevue/resources/themes/bootstrap4-light-purple/theme.css
|
|
|
|
primevue/resources/themes/bootstrap4-dark-blue/theme.css
|
|
|
|
primevue/resources/themes/bootstrap4-dark-purple/theme.css
|
|
|
|
primevue/resources/themes/md-light-indigo/theme.css
|
|
|
|
primevue/resources/themes/md-light-deeppurple/theme.css
|
|
|
|
primevue/resources/themes/md-dark-indigo/theme.css
|
|
|
|
primevue/resources/themes/md-dark-deeppurple/theme.css
|
|
|
|
primevue/resources/themes/mdc-light-indigo/theme.css
|
|
|
|
primevue/resources/themes/mdc-light-deeppurple/theme.css
|
|
|
|
primevue/resources/themes/mdc-dark-indigo/theme.css
|
|
|
|
primevue/resources/themes/mdc-dark-deeppurple/theme.css
|
2020-10-10 10:29:34 +00:00
|
|
|
primevue/resources/themes/fluent-light/theme.css
|
2020-05-13 14:54:04 +00:00
|
|
|
primevue/resources/themes/saga-blue/theme.css
|
|
|
|
primevue/resources/themes/saga-green/theme.css
|
|
|
|
primevue/resources/themes/saga-orange/theme.css
|
|
|
|
primevue/resources/themes/saga-purple/theme.css
|
|
|
|
primevue/resources/themes/vela-blue/theme.css
|
|
|
|
primevue/resources/themes/vela-green/theme.css
|
|
|
|
primevue/resources/themes/vela-orange/theme.css
|
|
|
|
primevue/resources/themes/vela-purple/theme.css
|
2020-06-26 13:37:03 +00:00
|
|
|
primevue/resources/themes/arya-blue/theme.css
|
|
|
|
primevue/resources/themes/arya-green/theme.css
|
|
|
|
primevue/resources/themes/arya-orange/theme.css
|
|
|
|
primevue/resources/themes/arya-purple/theme.css
|
2020-05-16 08:13:09 +00:00
|
|
|
primevue/resources/themes/nova/theme.css
|
|
|
|
primevue/resources/themes/nova-alt/theme.css
|
|
|
|
primevue/resources/themes/nova-accent/theme.css
|
2020-05-13 14:54:04 +00:00
|
|
|
primevue/resources/themes/nova-vue/theme.css
|
|
|
|
primevue/resources/themes/luna-amber/theme.css
|
|
|
|
primevue/resources/themes/luna-blue/theme.css
|
|
|
|
primevue/resources/themes/luna-green/theme.css
|
|
|
|
primevue/resources/themes/luna-pink/theme.css
|
|
|
|
primevue/resources/themes/rhea/theme.css
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2020-06-27 22:43:07 +00:00
|
|
|
|
|
|
|
<h5>Ripple</h5>
|
2020-06-27 23:26:53 +00:00
|
|
|
<p>Ripple is an optional animation for the supported components such as buttons. It is disabled by default and needs to be enabled at
|
2020-12-09 12:33:47 +00:00
|
|
|
your app's entry file (e.g. main.js) during the PrimeVue setup.
|
2020-06-27 22:43:07 +00:00
|
|
|
</p>
|
2020-09-24 11:14:55 +00:00
|
|
|
<pre v-code.script>
|
|
|
|
<code>
|
2020-09-26 09:57:15 +00:00
|
|
|
import {createApp} from 'vue';
|
2020-12-09 12:33:47 +00:00
|
|
|
import PrimeVue from 'primevue/config';
|
2020-09-26 09:57:15 +00:00
|
|
|
const app = createApp(App);
|
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
app.use(PrimeVue, {ripple: true});
|
2020-09-24 11:14:55 +00:00
|
|
|
|
|
|
|
</code></pre>
|
2019-05-21 12:06:16 +00:00
|
|
|
|
2020-12-09 12:33:47 +00:00
|
|
|
<h5>Locale</h5>
|
|
|
|
<p>PrimeVue provides a Locale API to support i18n and l7n, visit the <router-link to="/locale">Locale</router-link> documentation for more information.</p>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Quickstart</h5>
|
2019-05-30 13:45:06 +00:00
|
|
|
<p>An <a href="https://github.com/primefaces/primevue-quickstart">example application</a> based on vue-cli is available at github.</p>
|
2019-10-01 13:00:26 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Typescript</h5>
|
2019-05-30 13:45:06 +00:00
|
|
|
<p>Typescript is fully supported as type definition files are provided in the npm package of PrimeVue. A sample <a href="https://github.com/primefaces/primevue-typescript-quickstart">typescript-primevue</a> application is available as well at github.</p>
|
2019-10-01 13:00:26 +00:00
|
|
|
</div>
|
2019-05-21 12:06:16 +00:00
|
|
|
</div>
|
2020-09-11 16:50:20 +00:00
|
|
|
</template>
|