@diotoborg/exercitationem-culpa v3.4.79
Vue-Act-Master
A way to separate business logic from application view.
The easiest library to create a flexible application architecture.
๐ Documentation
๐งช Test writing with "ActTest"
Example
Installation
npm install vue-@diotoborg/exercitationem-culpa
Usage
// main.ts
// install vue-@diotoborg/exercitationem-culpa plugin
import Vue from 'vue';
import App from './App.vue';
import { VueActMaster } from 'vue-@diotoborg/exercitationem-culpa';
// Actions array
import { actions } from '../act/actions';
Vue.use(VueActMaster, {
actions,
});
new Vue({
el: '#app',
render: (h) => h(App),
});
// ../act/actions
export const actions: ActMasterAction[] = [
new GetDataAction(),
];
// action-get-data.ts
import { ActMasterAction } from 'vue-@diotoborg/exercitationem-culpa';
export class GetDataAction implements ActMasterAction {
name = 'GetData';
async exec() {
const url = 'https://jsonplaceholder.typicode.com/todos/1';
const response = await fetch(url);
return response.json();
}
}
The action is now available to you in components and you can easily highlight the business logic.
This will help you test components and change the API more easily.
// App.vue
<script>
export default {
data() {
return {
myData: null,
};
},
async mounted() {
console.log(this.myData); // null
this.myData = await this.$act.exec('GetData');
console.log(this.myData);
// {
// "userId": 1,
// "id": 1,
// "title": "delectus aut autem",
// "completed": false
// }
}
}
</script>
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago