continua upgrade Vue 3

This commit is contained in:
Paolo Arena
2021-09-02 03:22:13 +02:00
parent 1d6c55807c
commit 04a9ce2232
31 changed files with 5615 additions and 721 deletions

View File

@@ -0,0 +1,4 @@
.myflex{
display: flex;
flex: 1;
}

View File

@@ -0,0 +1,62 @@
import { defineComponent, onMounted, ref, watch } from 'vue'
import { useUserStore } from '@store/UserStore'
export default defineComponent({
name: 'CMyAvatar',
props: {
myimg: {
type: String,
required: false,
default: '',
},
size: {
type: String,
required: false,
default: '40px',
},
},
setup(props) {
let myicon = ref('')
let myimgint = ref('')
const userStore = useUserStore()
const imgprofile = ref(userStore.my.profile.img)
function refresh() {
if (!props.myimg) {
myicon.value = 'fas fa-user-circle'
} else {
myimgint.value = props.myimg
}
// console.log('myimgint', this.myimgint)
}
watch(
imgprofile,
// @ts-ignore
(value: string, oldValue: string) => {
userStore.my.profile.img = value
refresh()
},
)
watch(
// @ts-ignore
props.myimg,
// @ts-ignore
(value: string, oldValue: string) => {
myimgint.value = ''
refresh()
},
)
onMounted(refresh)
return {
myimgint,
}
},
})

View File

@@ -0,0 +1,17 @@
<template>
<div>
<q-avatar v-if="!myimgint" class="q-mb-sx center_img" :icon="myicon" :font-size="size">
</q-avatar>
<q-avatar v-if="myimgint" class="q-mb-sx center_img">
<img :src="myimgint" :font-size="size" alt="my avatar">
</q-avatar>
</div>
</template>
<script lang="ts" src="./CMyAvatar.ts">
</script>
<style lang="scss" scoped>
@import './CMyAvatar.scss';
</style>

View File

@@ -0,0 +1 @@
export { default as CMyAvatar } from './CMyAvatar.vue'