<template>
<div v-if="situation1">
(шаблон 1, здесь ссылки на Comp1...CompN, var1...varN, fn1...fnN)
</div>
<div v-else>
(шаблон 2, здесь ссылки на Comp1...CompN, var1...varN, fn1...fnN)
</div>
</template>
<script>
import Comp1 from '@/components/Comp1'
import Comp2 from '@/components/Comp2'
...
import CompN from '@/components/CompN'
export default {
name: 'MyComponent',
components: {
Comp1,
Comp2,
...
CompN
},
data: () => {
return {
var1: null,
var2: null,
...
varN
}
},
methods: {
fn1()...
fn2()...
fnN()...
},
...
}
</script>
sudo loginctl enable-linger $(whoami)
export PATH=/usr/bin:$PATH
export DOCKER_HOST=unix:///run/user/1000/docker.sock
systemctl --user status -l $SERVICE
$ systemctl --user enable --now docker
$systemctl --user start docker
$ systemctl --user is-enabled docker
enabled
$ docker ps
Cannot connect to the Docker daemon at unix:///run/user/1000/docker.sock. Is the docker daemon running?
$ systemctl --user is-enabled docker
enabled
$ systemctl --user start docker
Failed to start docker.service: Unit docker.service not found.
$ systemctl --user list-unit-files docker.service
UNIT FILE STATE
docker.service enabled
$systemctl --user start docker
Failed to start docker.service: Unit docker.service not found.
import store from '@/store'
import axios from 'axios'
...
router.beforeEach((to, from, next) => {
if (!store.state.Data) {
axios.post('https://site.ru/get_data').then(response => {
store.dispatch('setData', response.data.Data)
next()
} else {
next()
}
})
import Vue from 'vue'
...
import VueI18n from 'vue-i18n'
import f from '@/plugins/lib'
import * as messages from '@/assets/translate.json'
Vue.use(VueI18n)
Vue.use(f)
...
export const i18n = new VueI18n({ <------- вот здесь
locale: 'ru',
messages
})
new Vue({
i18n,
render: h => h(App)
}).$mount('#app')
import { i18n } from '../main.js' <--------
export default {
install (Vue) {
const fn = {
getBirthLabel (year, month, day) {
let label = ''
if (day) label += `${day} `
if (month) label += `${i18n.t('month')} ` <-------
if (year) label += year
return label
}
}
Vue.prototype.$f = fn
}
}
import Vue from 'vue'
...
import VueI18n from 'vue-i18n'
import f from '@/plugins/lib'
Vue.use(VueI18n)
Vue.use(f)
...
const i18n = new VueI18n({
locale: 'ru',
messages
})
new Vue({
i18n,
render: h => h(App)
}).$mount('#app')
export default {
install (Vue) {
const fn = {
getBirthLabel (year, month, day) {
let label = ''
if (day) label += `${day} `
if (month) label += `${this.$t('month')} `
if (year) label += year
return label
}
}
Vue.prototype.$f = fn
}
}
Спасибо!