primevue-mirror/doc/cdn/ExampleDoc.vue

63 lines
1.5 KiB
Vue
Raw Normal View History

2024-01-23 20:21:13 +00:00
<template>
<DocSectionText v-bind="$attrs">
2024-05-26 20:55:51 +00:00
<p>A complete example using a PrimeVue DatePicker. You can also view this sample live at <a href="https://stackblitz.com/edit/web-platform-jt1jz4?file=index.html" target="_blank" rel="noopener noreferrer">Stackblitz</a>.</p>
2024-01-23 20:21:13 +00:00
</DocSectionText>
2024-01-30 08:16:35 +00:00
<DocSectionCode :code="code" hideToggleCode hideStackBlitz />
2024-01-23 20:21:13 +00:00
</template>
<script>
export default {
data() {
return {
code: {
basic: `
<!DOCTYPE html>
<html lang="en">
<head>
<title>PrimeVue + CDN</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"><\/script>
2024-05-26 20:42:06 +00:00
<script src="https://unpkg.com/primevue/umd/primevue.min.js"><\/script>
<script src="https://unpkg.com/primevue/umd/themes/aura.min.js"><\/script>
2024-01-23 20:21:13 +00:00
<div id="app">
<p-datepicker v-model="date"></p-datepicker>
<br /><br />
{{ date }}
</div>
<script>
const { createApp, ref } = Vue;
const app = createApp({
setup() {
const date = ref();
2024-05-26 20:42:06 +00:00
2024-01-23 20:21:13 +00:00
return {
2024-05-26 20:42:06 +00:00
date
2024-01-23 20:21:13 +00:00
};
},
});
2024-05-26 20:42:06 +00:00
app.use(PrimeVue.Config, {
theme: {
preset: PrimeVue.Themes.Aura
}
});
app.component('p-datepicker', PrimeVue.DatePicker);
2024-01-23 20:21:13 +00:00
app.mount('#app');
<\/script>
</body>
</html>
`
}
};
}
};
</script>