croud-layout
Plugin
Step 1: Install plugin
yarn add croud-layout
Step 2: Add it to your project
import CroudLayout from 'croud-layout'
import store from './store'
Vue.use(CroudLayout, { store })
new Vue({
el: '#app',
template: '<croud-layout><App slot="content"/></croud-layout>',
components: { App },
store,
})
Step 3: ????
Step 4: Profit :)
Security Mixin
Croud-layout now includes the Security mixin that can make quick CRUD permission checks for the current user.
Basic Usage
import Security from 'croud-layout/src/mixin/security'
export default {
mixins: [Security],
data() {
return {
permission: {
read: 'my-read-permission',
custom: 'my-custom-permission',
},
},
},
}
This will add a security object to your component that looks like this (if they have the correct permissions)...
{
create: false,
read: true,
update: false,
delete: false,
custom: true,
}
Build Setup
npm install
npm run dev
npm run build
npm run build --report
npm run unit
npm test
For detailed explanation on how things work, checkout the guide and docs for vue-loader.