Vue.js fragments

All manner of googling didn’t turn up a good result for this problem. Sometimes, you need a wrapper component with logic attached that does not render to the UI. For example, child components with a percentage of the parent can’t just have a div wrapped around them for conditional logic. Another example (which I found […]

Nuxt.js Mixin – access global property in template

Adding a mixin in nuxt.js is just like adding a plugin. For my project, I needed a date format property set once but accessible in all my templates (named ‘moment_format’) Step 1, In plugins/, create a plugin file (Mine is called ‘vue-format-global.js) Step 2, connect up the plugin in nuxt.config.js Step 3, restart the app […]

Nuxt.js and Vuex – dumping flash messages

Context: A child component has received an error message, and needs to communicate it to the parent layout. There’s no unhacky way to do that, so we should put it in the application store (vuex). When the user navigates, the error is retained forever more. It’s a problem seemingly without a clean answer. Step 1: […]