NPM Vuejs Portlet
A portlet using Vue.js, integrated via Liferay’s JS Toolkit.
- Leverage Vue’s simplicity for small to medium apps.
- Migrate existing Vue apps to Liferay.
Implementation
Section titled “Implementation”Create the Portlet
Section titled “Create the Portlet”blade create -t npm-vuejs-portlet weather-widgetBuild a Vue Component
Section titled “Build a Vue Component”<template> <div> <h1>Weather in {{ city }}</h1> <p>Temperature: {{ temperature }}°C</p> <button @click="fetchWeather">Refresh</button> </div></template>
<script>export default { data() { return { city: "London", temperature: 20, }; }, methods: { fetchWeather() { // Simulate API call this.temperature = Math.floor(Math.random() * 30); }, },};</script>Register the Portlet
Section titled “Register the Portlet”import Vue from "vue";import App from "./App.vue";
new Vue({ render: (h) => h(App),}).$mount("#weather-widget");Use Cases
Section titled “Use Cases”- Dashboards: Real-time weather, stock tickers.
- Lightweight Apps: Surveys, polls.