- cataloghi...
- fix: condividi su Telegram non funzionava errore sull'immagine
This commit is contained in:
0
src/components/CMySize/CMySize.scss
Executable file
0
src/components/CMySize/CMySize.scss
Executable file
61
src/components/CMySize/CMySize.ts
Executable file
61
src/components/CMySize/CMySize.ts
Executable file
@@ -0,0 +1,61 @@
|
||||
import { defineComponent, ref, computed, PropType, toRef, reactive, watch } from 'vue'
|
||||
import { IOperators, ISize } from 'model'
|
||||
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { useQuasar } from 'quasar'
|
||||
|
||||
import { CMySlider } from '@src/components/CMySlider'
|
||||
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMySize',
|
||||
emits: ['update:modelValue'],
|
||||
components: { CMySlider },
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Object as PropType<ISize>,
|
||||
required: true,
|
||||
default: () => ({
|
||||
width: '',
|
||||
height: '',
|
||||
}),
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
disable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
|
||||
const internalModel = reactive({ ...props.modelValue })
|
||||
|
||||
function modifValueWidth(value: any) {
|
||||
emit('update:modelValue', { ...internalModel, width: value });
|
||||
}
|
||||
|
||||
function modifValueHeight(value: any) {
|
||||
emit('update:modelValue', { ...internalModel, height: value });
|
||||
}
|
||||
|
||||
// Sincronizzare i cambiamenti esterni con internalModel quando props cambiano
|
||||
watch(() => props.modelValue, (newModel: any) => {
|
||||
Object.assign(internalModel, newModel);
|
||||
}, { immediate: true });
|
||||
|
||||
return {
|
||||
t,
|
||||
shared_consts,
|
||||
modifValueWidth,
|
||||
modifValueHeight,
|
||||
internalModel,
|
||||
}
|
||||
}
|
||||
})
|
||||
41
src/components/CMySize/CMySize.vue
Executable file
41
src/components/CMySize/CMySize.vue
Executable file
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div style="width: 380px">
|
||||
<q-banner
|
||||
rounded
|
||||
dense
|
||||
class="bg-blue-1 text-red"
|
||||
color="primary q-title"
|
||||
style="text-align: center"
|
||||
>
|
||||
{{ label }}
|
||||
</q-banner>
|
||||
|
||||
<div class="row">
|
||||
<CMySlider
|
||||
label="Width:"
|
||||
v-model="internalModel.width"
|
||||
:min="10"
|
||||
:max="3000"
|
||||
color="green"
|
||||
addstr="px"
|
||||
@update:model-value="modifValueWidth"
|
||||
></CMySlider>
|
||||
<CMySlider
|
||||
label="Height:"
|
||||
v-model="internalModel.height"
|
||||
:min="10"
|
||||
:max="3000"
|
||||
color="red"
|
||||
addstr="px"
|
||||
@update:model-value="modifValueHeight"
|
||||
></CMySlider>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMySize.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMySize.scss';
|
||||
</style>
|
||||
1
src/components/CMySize/index.ts
Executable file
1
src/components/CMySize/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CMySize} from './CMySize.vue'
|
||||
Reference in New Issue
Block a user