This is a top navigation bar template for node-red-contrib-uibuilder v5.1.1.
( It uses Vue 2, bootstrap-vue and vue-router for the navigation between pages )
Each page is a seperate .vue component file (Single File Component) that loads in the parent App.vue
using vue-router. We use a SFC for each page to seperate and make the design cleaner with its own code and functionality.
Folder structure :
Because we are using .vue files and modern javascript syntax in our application, we'll need a bundler to build/translate that code into plain javascript so the browser can understand. In this project we use Vite.
You dont have to worry about installing or configuring anything with Vite, it gets installed when you run npm install
as it is in package.json
devDependencies, along with two script commands npm run build
to build your app and npm run dev
which spins a dev server and watches for any file changes with Hot Module Reloading, which makes development much faster.
Enough with the intro .. lets get coding.
navbar
Load an external template using Degit
and load the template fromunborn-andy/uib-template-vue-navbar
/dist
folder.~/.node-red/uibuilder/navbar
run npm install
to install all the dependencies of the app based on the package.json file.npm run build
so Vite will build the app into the /dist
folder.npm run dev
so Vite will spin up a dev server with Hot Module Reloading.navbar
.router.js
change base: "navbar",
and in app.js
change the ioNamespace subpath of : uibuilder.start({ ioNamespace: `https://${document.location.hostname}:1880/navbar`, ioPath: "/uibuilder/vendor/socket.io", loadStylesheet: false });
router.js
and NavBar.vue
files. npm run build