All demos added

This commit is contained in:
Bahadır Sofuoğlu
2022-11-04 02:27:06 +03:00
parent 1ee46af467
commit 3e45c1cf61
11 changed files with 1323 additions and 973 deletions

View File

@@ -27,11 +27,11 @@ defineProps({
<span class="layout-menuitem-text">{{ item.label }}</span>
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" v-if="item.items"></i>
</a>
<a v-if="item.to && !item.items && item.visible !== false" @click="itemClick($event)" :class="item.class" tabindex="0" :to="item.to">
<router-link v-if="item.to && !item.items && item.visible !== false" @click="itemClick($event)" :class="[item.class, { 'active-route': active }]" tabindex="0" :to="item.to">
<i :class="item.icon" class="layout-menuitem-icon"></i>
<span class="layout-menuitem-text">{{ item.label }}</span>
<i class="pi pi-fw pi-angle-down layout-submenu-toggler" v-if="item.items"></i>
</a>
</router-link>
<Transition class="layout-submenu">
<ul v-if="item.items && item.visible !== false">
<app-menu-item v-for="(child, i) in item.items" :key="child" :index="i" :item="child" :root="false"></app-menu-item>

View File

@@ -1,11 +1,13 @@
export default class NodeService {
getTreeTableNodes () {
return fetch('data/treetablenodes.json').then(res => res.json()).then(d => d.root);
return fetch('/data/treetablenodes.json')
.then(res => res.json())
.then(d => d.root);
}
getTreeNodes () {
return fetch('data/treenodes.json').then(res => res.json()).then(d => d.root);
return fetch('/data/treenodes.json')
.then(res => res.json())
.then(d => d.root);
}
}

View File

@@ -1,7 +1,7 @@
export default class PhotoService {
getImages () {
return fetch('data/photos.json').then(res => res.json())
return fetch('/data/photos.json')
.then(res => res.json())
.then(d => d.data);
}
}

View File

@@ -1,15 +1,19 @@
export default class ProductService {
getProductsSmall () {
return fetch('data/products-small.json').then(res => res.json()).then(d => d.data);
return fetch('/data/products-small.json')
.then(res => res.json())
.then(d => d.data);
}
getProducts () {
return fetch('data/products.json').then(res => res.json()).then(d => d.data);
return fetch('/data/products.json')
.then(res => res.json())
.then(d => d.data);
}
getProductsWithOrdersSmall () {
return fetch('data/products-orders-small.json').then(res => res.json()).then(d => d.data);
return fetch('/data/products-orders-small.json')
.then(res => res.json())
.then(d => d.data);
}
}

View File

@@ -9,65 +9,85 @@ const router = createRouter({
component: AppLayout,
children: [
{
path: '',
path: '/',
name: 'dashboard',
component: () => import('@/views/Dashboard.vue')
},
{
path: '/formlayout',
path: '/uikit/formlayout',
name: 'formlayout',
component: () => import('@/views/demo/FormLayout.vue')
},
{
path: '/input',
path: '/uikit/input',
name: 'input',
component: () => import('@/views/demo/Input.vue')
},
{
path: '/floatlabel',
path: '/uikit/floatlabel',
name: 'floatlabel',
component: () => import('@/views/demo/FloatLabel.vue')
},
{
path: '/invalidstate',
path: '/uikit/invalidstate',
name: 'invalidstate',
component: () => import('@/views/demo/InvalidState.vue')
},
{
path: '/button',
path: '/uikit/button',
name: 'button',
component: () => import('@/views/demo/Button.vue')
},
{
path: '/table',
path: '/uikit/table',
name: 'table',
component: () => import('@/views/demo/Table.vue')
},
{
path: '/list',
path: '/uikit/list',
name: 'list',
component: () => import('@/views/demo/List.vue')
},
{
path: '/tree',
path: '/uikit/tree',
name: 'tree',
component: () => import('@/views/demo/Tree.vue')
},
{
path: '/panel',
path: '/uikit/panel',
name: 'panel',
component: () => import('@/views/demo/Panels.vue')
},
{
path: '/overlay',
path: '/uikit/overlay',
name: 'overlay',
component: () => import('@/views/demo/Overlay.vue')
},
{
path: '/media',
path: '/uikit/media',
name: 'media',
component: () => import('@/views/demo/Media.vue')
},
{
path: '/uikit/menu',
name: 'menu',
component: () => import('@/views/demo/Menu.vue')
},
{
path: '/uikit/message',
name: 'message',
component: () => import('@/views/demo/Messages.vue')
},
{
path: '/uikit/file',
name: 'file',
component: () => import('@/views/demo/File.vue')
},
{
path: '/uikit/misc',
name: 'misc',
component: () => import('@/views/demo/Misc.vue')
}
/*
@@ -75,12 +95,12 @@ const router = createRouter({
{
path: '/overlay',
path: '/uikit/overlay',
name: 'overlay',
component: () => import('./components/OverlayDemo.vue')
},
{
path: '/media',
path: '/uikit/media',
name: 'media',
component: () => import('./components/MediaDemo.vue')
} */

357
src/views/demo/Chart.vue Normal file
View File

@@ -0,0 +1,357 @@
<template>
<div class="grid p-fluid">
<div class="col-12 lg:col-6">
<div class="card">
<h5>Linear Chart</h5>
<Chart type="line" :data="lineData" :options="lineOptions" />
</div>
<div class="card flex flex-column align-items-center">
<h5 class="align-self-start">Pie Chart</h5>
<Chart type="pie" :data="pieData" :options="pieOptions" style="width: 50%" />
</div>
<div class="card flex flex-column align-items-center">
<h5 class="align-self-start">Polar Area Chart</h5>
<Chart type="polarArea" :data="polarData" :options="polarOptions" style="width: 50%" />
</div>
</div>
<div class="col-12 lg:col-6">
<div class="card">
<h5>Bar Chart</h5>
<Chart type="bar" :data="barData" :options="barOptions" />
</div>
<div class="card flex flex-column align-items-center">
<h5 class="align-self-start">Doughnut Chart</h5>
<Chart type="doughnut" :data="pieData" :options="pieOptions" style="width: 50%" />
</div>
<div class="card flex flex-column align-items-center">
<h5 class="align-self-start">Radar Chart</h5>
<Chart type="radar" :data="radarData" :options="radarOptions" style="width: 50%" />
</div>
</div>
</div>
</template>
<script>
import EventBus from '@/AppEventBus';
export default {
themeChangeListener: null,
mounted() {
this.themeChangeListener = (event) => {
if (event.dark) this.applyDarkTheme();
else this.applyLightTheme();
};
EventBus.on('change-theme', this.themeChangeListener);
if (this.isDarkTheme()) {
this.applyDarkTheme();
} else {
this.applyLightTheme();
}
},
beforeUnmount() {
EventBus.off('change-theme', this.themeChangeListener);
},
data() {
return {
lineData: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'First Dataset',
data: [65, 59, 80, 81, 56, 55, 40],
fill: false,
backgroundColor: '#2f4860',
borderColor: '#2f4860',
tension: 0.4
},
{
label: 'Second Dataset',
data: [28, 48, 40, 19, 86, 27, 90],
fill: false,
backgroundColor: '#00bb7e',
borderColor: '#00bb7e',
tension: 0.4
}
]
},
pieData: {
labels: ['A', 'B', 'C'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56'],
hoverBackgroundColor: ['#FF6384', '#36A2EB', '#FFCE56']
}
]
},
polarData: {
datasets: [
{
data: [11, 16, 7, 3, 14],
backgroundColor: ['#FF6384', '#4BC0C0', '#FFCE56', '#E7E9ED', '#36A2EB'],
label: 'My dataset'
}
],
labels: ['Red', 'Green', 'Yellow', 'Grey', 'Blue']
},
barData: {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
backgroundColor: '#2f4860',
data: [65, 59, 80, 81, 56, 55, 40]
},
{
label: 'My Second dataset',
backgroundColor: '#00bb7e',
data: [28, 48, 40, 19, 86, 27, 90]
}
]
},
radarData: {
labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'],
datasets: [
{
label: 'My First dataset',
backgroundColor: 'rgba(179,181,198,0.2)',
borderColor: 'rgba(179,181,198,1)',
pointBackgroundColor: 'rgba(179,181,198,1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(179,181,198,1)',
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: 'My Second dataset',
backgroundColor: 'rgba(255,99,132,0.2)',
borderColor: 'rgba(255,99,132,1)',
pointBackgroundColor: 'rgba(255,99,132,1)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgba(255,99,132,1)',
data: [28, 48, 40, 19, 96, 27, 100]
}
]
},
lineOptions: null,
pieOptions: null,
polarOptions: null,
barOptions: null,
radarOptions: null
};
},
methods: {
isDarkTheme() {
return this.$appState.darkTheme === true;
},
applyLightTheme() {
this.lineOptions = {
plugins: {
legend: {
labels: {
color: '#495057'
}
}
},
scales: {
x: {
ticks: {
color: '#495057'
},
grid: {
color: '#ebedef'
}
},
y: {
ticks: {
color: '#495057'
},
grid: {
color: '#ebedef'
}
}
}
};
this.barOptions = {
plugins: {
legend: {
labels: {
color: '#495057'
}
}
},
scales: {
x: {
ticks: {
color: '#495057'
},
grid: {
color: '#ebedef'
}
},
y: {
ticks: {
color: '#495057'
},
grid: {
color: '#ebedef'
}
}
}
};
this.pieOptions = {
plugins: {
legend: {
labels: {
color: '#495057'
}
}
}
};
this.polarOptions = {
plugins: {
legend: {
labels: {
color: '#495057'
}
}
},
scales: {
r: {
grid: {
color: '#ebedef'
}
}
}
};
this.radarOptions = {
plugins: {
legend: {
labels: {
color: '#495057'
}
}
},
scales: {
r: {
grid: {
color: '#ebedef'
}
}
}
};
},
applyDarkTheme() {
this.lineOptions = {
plugins: {
legend: {
labels: {
color: '#ebedef'
}
}
},
scales: {
x: {
ticks: {
color: '#ebedef'
},
grid: {
color: 'rgba(160, 167, 181, .3)'
}
},
y: {
ticks: {
color: '#ebedef'
},
grid: {
color: 'rgba(160, 167, 181, .3)'
}
}
}
};
this.barOptions = {
plugins: {
legend: {
labels: {
color: '#ebedef'
}
}
},
scales: {
x: {
ticks: {
color: '#ebedef'
},
grid: {
color: 'rgba(160, 167, 181, .3)'
}
},
y: {
ticks: {
color: '#ebedef'
},
grid: {
color: 'rgba(160, 167, 181, .3)'
}
}
}
};
this.pieOptions = {
plugins: {
legend: {
labels: {
color: '#ebedef'
}
}
}
};
this.polarOptions = {
plugins: {
legend: {
labels: {
color: '#ebedef'
}
}
},
scales: {
r: {
grid: {
color: 'rgba(160, 167, 181, .3)'
}
}
}
};
this.radarOptions = {
plugins: {
legend: {
labels: {
color: '#ebedef'
}
}
},
scales: {
r: {
grid: {
color: 'rgba(160, 167, 181, .3)'
}
}
}
};
}
}
};
</script>

View File

@@ -12,12 +12,12 @@
</div>
</template>
<script>
export default {
methods: {
onUpload() {
this.$toast.add({severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000});
}
}
}
<script setup>
import { useToast } from 'primevue/usetoast';
const toast = useToast();
const onUpload = () => {
toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
};
</script>

View File

@@ -108,17 +108,14 @@
</div>
</template>
<script>
export default {
data() {
return {
dropdownItems: [
<script setup>
import { ref } from 'vue';
const dropdownItems = ref([
{ name: 'Option 1', code: 'Option 1' },
{ name: 'Option 2', code: 'Option 2' },
{ name: 'Option 3', code: 'Option 3' }
],
dropdownItem: null
}
}
}
]);
const dropdownItem = ref(null);
</script>

View File

@@ -84,15 +84,16 @@
<PanelMenu :model="panelMenuitems" />
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
nestedMenuitems: [
<script setup>
import { ref } from 'vue';
const menu = ref(null);
const contextMenu = ref(null);
const nestedMenuitems = ref([
{
label: 'Customers',
icon: 'pi pi-fw pi-table',
@@ -108,8 +109,7 @@
{
label: 'Duplicate',
icon: 'pi pi-fw pi-copy'
},
}
]
},
{
@@ -129,8 +129,7 @@
{
label: 'Search',
icon: 'pi pi-fw pi-search'
},
}
]
},
{
@@ -140,12 +139,10 @@
{
label: 'Tracker',
icon: 'pi pi-fw pi-compass'
},
{
label: 'Map',
icon: 'pi pi-fw pi-map-marker'
},
{
label: 'Manage',
@@ -171,16 +168,10 @@
label: 'Quit',
icon: 'pi pi-fw pi-sign-out'
}
],
breadcrumbHome: {icon: 'pi pi-home', to: '/'},
breadcrumbItems: [
{label:'Computer'},
{label:'Notebook'},
{label:'Accessories'},
{label:'Backpacks'},
{label:'Item'}
],
nestedRouteItems: [
]);
const breadcrumbHome = ref({ icon: 'pi pi-home', to: '/' });
const breadcrumbItems = ref([{ label: 'Computer' }, { label: 'Notebook' }, { label: 'Accessories' }, { label: 'Backpacks' }, { label: 'Item' }]);
const nestedRouteItems = ref([
{
label: 'Personal',
to: '/menu'
@@ -197,8 +188,8 @@
label: 'Confirmation',
to: '/menu/confirmation'
}
],
tieredMenuItems: [
]);
const tieredMenuItems = ref([
{
label: 'Customers',
icon: 'pi pi-fw pi-table',
@@ -214,8 +205,7 @@
{
label: 'Duplicate',
icon: 'pi pi-fw pi-copy'
},
}
]
},
{
@@ -235,8 +225,7 @@
{
label: 'Search',
icon: 'pi pi-fw pi-search'
},
}
]
},
{
@@ -246,12 +235,10 @@
{
label: 'Tracker',
icon: 'pi pi-fw pi-compass'
},
{
label: 'Map',
icon: 'pi pi-fw pi-map-marker'
},
{
label: 'Manage',
@@ -280,8 +267,8 @@
label: 'Quit',
icon: 'pi pi-fw pi-sign-out'
}
],
overlayMenuItems: [
]);
const overlayMenuItems = ref([
{
label: 'Save',
icon: 'pi pi-save'
@@ -300,15 +287,15 @@
{
label: 'Home',
icon: 'pi pi-home'
},
],
menuitems: [
}
]);
const menuitems = ref([
{
label: 'Customers',
items: [
{
label: 'New',
icon:'pi pi-fw pi-plus',
icon: 'pi pi-fw pi-plus'
},
{
label: 'Edit',
@@ -326,12 +313,11 @@
{
label: 'Search',
icon: 'pi pi-fw pi-search'
},
}
]
}
],
contextMenuItems: [
]);
const contextMenuItems = ref([
{
label: 'Save',
icon: 'pi pi-save'
@@ -350,11 +336,12 @@
{
label: 'Options',
icon: 'pi pi-cog'
},
],
megamenuItems: [
}
]);
const megamenuItems = ref([
{
label: 'Fashion', icon: 'pi pi-fw pi-tag',
label: 'Fashion',
icon: 'pi pi-fw pi-tag',
items: [
[
{
@@ -379,7 +366,8 @@
]
},
{
label: 'Electronics', icon: 'pi pi-fw pi-desktop',
label: 'Electronics',
icon: 'pi pi-fw pi-desktop',
items: [
[
{
@@ -388,8 +376,8 @@
},
{
label: 'Camcorder',
items: [{label: 'Camcorder Item'}, {label: 'Camcorder Item'}, {label: 'Camcorder Item'}, ]
},
items: [{ label: 'Camcorder Item' }, { label: 'Camcorder Item' }, { label: 'Camcorder Item' }]
}
],
[
{
@@ -410,12 +398,13 @@
]
},
{
label: 'Furniture', icon: 'pi pi-fw pi-image',
label: 'Furniture',
icon: 'pi pi-fw pi-image',
items: [
[
{
label: 'Living Room',
items: [{label: 'Living Room Item'}, {label: 'Living Room Item'}, ]
items: [{ label: 'Living Room Item' }, { label: 'Living Room Item' }]
},
{
label: 'Kitchen',
@@ -435,7 +424,8 @@
]
},
{
label: 'Sports', icon: 'pi pi-fw pi-star',
label: 'Sports',
icon: 'pi pi-fw pi-star',
items: [
[
{
@@ -455,8 +445,8 @@
]
]
}
],
panelMenuitems: [
]);
const panelMenuitems = ref([
{
label: 'Customers',
icon: 'pi pi-fw pi-table',
@@ -472,8 +462,7 @@
{
label: 'Duplicate',
icon: 'pi pi-fw pi-copy'
},
}
]
},
{
@@ -493,8 +482,7 @@
{
label: 'Search',
icon: 'pi pi-fw pi-search'
},
}
]
},
{
@@ -504,12 +492,10 @@
{
label: 'Tracker',
icon: 'pi pi-fw pi-compass'
},
{
label: 'Map',
icon: 'pi pi-fw pi-map-marker'
},
{
label: 'Manage',
@@ -531,16 +517,13 @@
}
]
}
],
}
},
methods: {
toggleMenu(event) {
this.$refs.menu.toggle(event);
},
onContextRightClick(event) {
this.$refs.contextMenu.show(event);
}
}
}
]);
const toggleMenu = (event) => {
menu.value.toggle(event);
};
const onContextRightClick = (event) => {
contextMenu.value.show(event);
};
</script>

View File

@@ -60,42 +60,40 @@
</div>
</template>
<script>
export default {
data() {
return {
message: [],
username:null,
email:null
}
},
methods: {
addMessage(type) {
<script setup>
import { ref } from 'vue';
import { useToast } from 'primevue/usetoast';
const toast = useToast();
const message = ref([]);
const username = ref(null);
const email = ref(null);
const addMessage = (type) => {
if (type === 'success') {
this.message = [{severity: 'success', detail: 'Success Message', content: 'Message sent', id: this.count++}]
}
else if(type === 'info') {
this.message = [{severity: 'info', detail: 'Info Message', content: 'PrimeVue rocks', id: this.count++}]
}
else if(type === 'warn') {
this.message = [{severity: 'warn', detail: 'Warn Message', content: 'There are unsaved changes', id: this.count++}]
}
else if(type === 'error') {
this.message = [{severity: 'error', detail: 'Error Message', content: 'Validation failed', id: this.count++}]
}
},
showSuccess() {
this.$toast.add({severity:'success', summary: 'Success Message', detail:'Message Detail', life: 3000});
},
showInfo() {
this.$toast.add({severity:'info', summary: 'Info Message', detail:'Message Detail', life: 3000});
},
showWarn() {
this.$toast.add({severity:'warn', summary: 'Warn Message', detail:'Message Detail', life: 3000});
},
showError() {
this.$toast.add({severity:'error', summary: 'Error Message', detail:'Message Detail', life: 3000});
},
}
this.message = [{ severity: 'success', detail: 'Success Message', content: 'Message sent', id: this.count++ }];
} else if (type === 'info') {
this.message = [{ severity: 'info', detail: 'Info Message', content: 'PrimeVue rocks', id: this.count++ }];
} else if (type === 'warn') {
this.message = [{ severity: 'warn', detail: 'Warn Message', content: 'There are unsaved changes', id: this.count++ }];
} else if (type === 'error') {
this.message = [{ severity: 'error', detail: 'Error Message', content: 'Validation failed', id: this.count++ }];
}
};
const showSuccess = () => {
toast.add({ severity: 'success', summary: 'Success Message', detail: 'Message Detail', life: 3000 });
};
const showInfo = () => {
toast.add({ severity: 'info', summary: 'Info Message', detail: 'Message Detail', life: 3000 });
};
const showWarn = () => {
toast.add({ severity: 'warn', summary: 'Warn Message', detail: 'Message Detail', life: 3000 });
};
const showError = () => {
toast.add({ severity: 'error', summary: 'Error Message', detail: 'Message Detail', life: 3000 });
};
</script>

View File

@@ -30,7 +30,6 @@
<i class="pi pi-calendar mr-4 p-text-secondary" style="font-size: 2rem" v-badge.danger="'10+'"></i>
<i class="pi pi-envelope p-text-secondary" style="font-size: 2rem" v-badge.danger></i>
<h5>Inline Button Badge</h5>
<Button label="Emails" badge="8" class="mr-2"></Button>
<Button label="Messages" icon="pi pi-users" class="p-button-warning" badge="8" badgeClass="p-badge-danger"></Button>
@@ -52,13 +51,13 @@
<Avatar image="images/avatar/onyamalimba.png" size="large" shape="circle"></Avatar>
<Avatar image="images/avatar/ionibowcher.png" size="large" shape="circle"></Avatar>
<Avatar image="images/avatar/xuxuefeng.png" size="large" shape="circle"></Avatar>
<Avatar label="+2" shape="circle" size="large" :style="{'background-color':'#9c27b0', 'color': '#ffffff'}"></Avatar>
<Avatar label="+2" shape="circle" size="large" :style="{ 'background-color': '#9c27b0', color: '#ffffff' }"></Avatar>
</AvatarGroup>
<h5>Label - Circle</h5>
<Avatar label="P" class="mr-2" size="xlarge" shape="circle"></Avatar>
<Avatar label="V" class="mr-2" size="large" :style="{'background-color':'#2196F3', 'color': '#ffffff'}" shape="circle"></Avatar>
<Avatar label="U" class="mr-2" :style="{'background-color': '#9c27b0', 'color': '#ffffff'}" shape="circle"></Avatar>
<Avatar label="V" class="mr-2" size="large" :style="{ 'background-color': '#2196F3', color: '#ffffff' }" shape="circle"></Avatar>
<Avatar label="U" class="mr-2" :style="{ 'background-color': '#9c27b0', color: '#ffffff' }" shape="circle"></Avatar>
<h5>Icon - Badge</h5>
<Avatar icon="pi pi-user" class="mr-2" size="xlarge" v-badge.success="4"></Avatar>
@@ -68,17 +67,11 @@
<h4>ScrollTop</h4>
<ScrollPanel :style="{ width: '250px', height: '200px' }">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Vitae et leo duis ut diam.
Ultricies mi quis hendrerit dolor magna eget est lorem. Amet consectetur adipiscing elit ut.
Nam libero justo laoreet sit amet. Pharetra massa massa ultricies mi quis hendrerit dolor magna.
Est ultricies integer quis auctor elit sed vulputate. Consequat ac felis donec et. Tellus orci ac auctor augue mauris.
Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus a. Tincidunt arcu non sodales neque sodales.
Metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices. Sodales ut etiam sit amet nisl purus.
Cursus sit amet dictum sit amet. Tristique senectus et netus et malesuada fames ac turpis egestas.
Et tortor consequat id porta nibh venenatis cras sed. Diam maecenas ultricies mi eget mauris.
Eget egestas purus viverra accumsan in nisl nisi. Suscipit adipiscing bibendum est ultricies integer.
Mattis aliquam faucibus purus in massa tempor nec.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vitae et leo duis ut diam. Ultricies mi quis hendrerit dolor magna eget est lorem. Amet consectetur
adipiscing elit ut. Nam libero justo laoreet sit amet. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Est ultricies integer quis auctor elit sed vulputate. Consequat ac felis donec et. Tellus orci ac auctor
augue mauris. Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus a. Tincidunt arcu non sodales neque sodales. Metus aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices. Sodales ut etiam sit amet
nisl purus. Cursus sit amet dictum sit amet. Tristique senectus et netus et malesuada fames ac turpis egestas. Et tortor consequat id porta nibh venenatis cras sed. Diam maecenas ultricies mi eget mauris. Eget egestas purus
viverra accumsan in nisl nisi. Suscipit adipiscing bibendum est ultricies integer. Mattis aliquam faucibus purus in massa tempor nec.
</p>
<ScrollTop target="parent" :threshold="100" icon="pi pi-arrow-up"></ScrollTop>
</ScrollPanel>
@@ -155,37 +148,33 @@
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
value: 0
}
},
interval: null,
methods: {
startProgress() {
this.interval = setInterval(() => {
let newValue = this.value + Math.floor(Math.random() * 10) + 1;
<script setup>
import { ref, onMounted, onBeforeUnmount } from 'vue';
const value = ref(0);
let interval = null;
const startProgress = () => {
interval = setInterval(() => {
let newValue = value.value + Math.floor(Math.random() * 10) + 1;
if (newValue >= 100) {
newValue = 100;
}
this.value = newValue;
value.value = newValue;
}, 2000);
},
endProgress() {
clearInterval(this.interval);
this.interval = null;
}
},
mounted() {
this.startProgress();
},
beforeUnmount() {
this.endProgress();
}
}
};
const endProgress = () => {
clearInterval(interval);
interval = null;
};
onMounted(() => {
startProgress();
});
onBeforeUnmount(() => {
endProgress();
});
</script>