This project was bootstrapped with Vue CLI using VUE UI.
-
Use @vue/cli CLI to create application skeleton
In the target folder
npm install -g @vue/cli vue create kc-vue # Use default setup cd kc-vue # Use default setup
or
npm install -g @vue/cli vue ui # Use http://localhost:8000/project/ to create a new project using the UI cd kc-vue
-
Install Kentico Cloud JavaScript SDK
npm install --save rxjs kentico-cloud-delivery
-
Extend Hello world component (final state)
-
Add required imports
import { DeliveryClient } from 'kentico-cloud-delivery';
-
Initialize client
const client = new DeliveryClient({ projectId: "975bf280-fd91-488c-994c-2f04416e5ee3" });
-
Define component initial data - as a function
data: function() { return { loaded: false, articles: [] }; },
-
Load the data to the component state using the client in component
mounted
hook.mounted: function(){ client.items() .type("article") .getPromise() .then(result => { // eslint-disable-next-line no-console console.log(result.items); this.articles = result.items; this.loaded = true; }); }
-
Set the data to be rendered in the component template section using v-for
<section v-if="loaded"> <ul v-for="article in articles" v-bind:key="article.system.id"> <li>{{article.elements.title.value}}</li> </ul> </section
-
-
Run the app
npm run serve
Hurray! Kentico Cloud ❤️ Vue!
npm install
npm run serve
npm run build
npm run test
npm run lint