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,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,
}
},
})