添加跟换图片功能
This commit is contained in:
parent
6481604b95
commit
f0b652c600
|
|
@ -1,12 +1,20 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useEditorStore } from '@/stores/editor';
|
import { useEditorStore } from '@/stores/editor';
|
||||||
import { useHoverTiltStore } from '@/stores/hoverTilt';
|
import { useHoverTiltStore } from '@/stores/hoverTilt';
|
||||||
import { computed } from 'vue';
|
import {computed, watchEffect} from 'vue';
|
||||||
const store = useEditorStore();
|
const store = useEditorStore();
|
||||||
const tilt_store = useHoverTiltStore();
|
const tilt_store = useHoverTiltStore();
|
||||||
|
|
||||||
const borderRadiusStyle = computed(() => ({
|
const borderRadiusStyle = computed(() => ({
|
||||||
'--border-radius': store.formData['border-radius'] + 'px'
|
'--border-radius': store.formData['border-radius'] + 'px'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
console.log(tilt_store.tiltProps.shadow)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
@ -19,7 +27,7 @@ img {
|
||||||
<!-- 利用这个元素承载 style 穿透到hover-tilt 内 -->
|
<!-- 利用这个元素承载 style 穿透到hover-tilt 内 -->
|
||||||
<div class="container" :style="borderRadiusStyle">
|
<div class="container" :style="borderRadiusStyle">
|
||||||
<hover-tilt v-bind="tilt_store.tiltProps" class="hover-tilt">
|
<hover-tilt v-bind="tilt_store.tiltProps" class="hover-tilt">
|
||||||
<img :src="store.formData.image.src" :style="store.imageStyle" />
|
<img :src="store.formData.image?.src ?? 'https://images.pokemontcg.io/swsh4/25_hires.png'" :style="store.imageStyle" />
|
||||||
</hover-tilt>
|
</hover-tilt>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,13 @@ export const hoverTiltConfig = [
|
||||||
step: 50
|
step: 50
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: "shadow2",
|
||||||
|
value: true,
|
||||||
|
params: {
|
||||||
|
}
|
||||||
|
},
|
||||||
//TODO:shadow @see https://hover-tilt.simey.me/options/props/#shadow
|
//TODO:shadow @see https://hover-tilt.simey.me/options/props/#shadow
|
||||||
{
|
{
|
||||||
label: "shadow-blur",
|
label: "shadow-blur",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export const useHoverTiltStore = defineStore('hoverTilt', () => {
|
||||||
const tiltProps = computed(() => {
|
const tiltProps = computed(() => {
|
||||||
const props: Record<string, any> = {}
|
const props: Record<string, any> = {}
|
||||||
Object.entries(formData).forEach(([key, value]) => {
|
Object.entries(formData).forEach(([key, value]) => {
|
||||||
if (value !== undefined) {
|
if (value !== undefined && value !== false) {
|
||||||
props[key] = value
|
props[key] = value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user