const gulp = require('gulp');
const fs = require('fs');
const path = require('path');
const watcher = gulp.watch('./pages', { events: ['add'] });
watcher.on('add', function(p, stats) {
const name = path.basename(p, path.extname(p));
fs.writeFileSync(`./controllers/${name}.controller.js`, 'то, что будет в файле');
});
php artisan make:controller PhotoController
props
AppTest.vue
components/
Test-1.vue
Test-2.vue
<div>
<app-test component-name="Test-1" />
</div>
<template>
<div>
<component :is="componentName"></component>
</div>
</template>
<script>
export default {
props: {
componentName: String,
},
created() {
this.$options.components[this.componentName] = () => import(`./components/${this.componentName}.vue`);
}
};
</script>
// 1 вариант
app.get('/api/users', ...)
app.post('/api/users', ...)
app.put('/api/users', ...)
let router = new Router();
// 2 вариант
router.get('/users', ...)
router.post('/users', ...)
router.put('/users', ...)
app.use('/api', router);
const component = () => ({
component: import('./Some.vue'),
loading: LoadingComponent,
error: ErrorComponent,
timeout: 3000
});