chore: add ide configs, new svg icon and optimize header & icon component
1. 新增.idea系列IDE配置文件 2. 添加圆形箭头svg图标 3. 优化AppHeader返回图标尺寸和位置 4. 重构AppIcon支持svg矢量图标
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<view class="header-wrap">
|
||||
<view class="status-bar"></view>
|
||||
<view class="app-header">
|
||||
<view class="header-side" @click="handleBack"><AppIcon v-if="back" name="chevron-right" :size="44" class="back-icon" /></view>
|
||||
<view class="header-side" @click="handleBack"><AppIcon v-if="back" name="chevron-right" :size="34" class="back-icon" /></view>
|
||||
<text class="header-title">{{ title }}</text>
|
||||
<view class="header-side header-right"><slot></slot></view>
|
||||
</view>
|
||||
@@ -26,6 +26,6 @@
|
||||
.app-header { height: 96rpx; padding: 0 24rpx; flex-direction: row; align-items: center; justify-content: space-between; border-bottom: 1rpx solid #edf1f7; }
|
||||
.header-side { width: 100rpx; height: 96rpx; align-items: flex-start; justify-content: center; }
|
||||
.header-right { align-items: flex-end; }
|
||||
.back-icon { transform: rotate(180deg) scale(1.2); margin-top: 30rpx; }
|
||||
.back-icon { transform: rotate(180deg); margin-top: 0; }
|
||||
.header-title { font-size: 34rpx; font-weight: 700; color: #111d35; }
|
||||
</style>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<image class="app-icon" :class="muted ? 'muted-icon' : ''" :style="iconStyle" :src="iconSrc" mode="aspectFit"></image>
|
||||
<image class="app-icon" :class="(muted ? 'muted-icon ' : '') + (isVector ? 'vector-icon' : '')" :style="iconStyle" :src="iconSrc" mode="aspectFit"></image>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const props = defineProps({ name: { type: String, default: 'sparkles' }, size: { type: Number, default: 42 }, muted: { type: Boolean, default: false } })
|
||||
const iconSrc = computed(() => '/static/icons-generated/' + props.name + '.png')
|
||||
const isVector = computed(() => props.name == 'chevron-right' || props.name == 'arrow-right')
|
||||
const iconSrc = computed(() => isVector.value ? '/static/icons/' + (props.name == 'chevron-right' ? 'chevron-circle' : 'arrow-right') + '.svg' : '/static/icons-generated/' + props.name + '.png')
|
||||
const iconStyle = computed(() => 'width:' + props.size + 'rpx;height:' + props.size + 'rpx;')
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.app-icon { display: block; flex-shrink: 0; transform: scale(1.2); }.muted-icon { opacity: .48; }
|
||||
.app-icon { display: block; flex-shrink: 0; transform: scale(1.2); }.vector-icon { transform: none; }.muted-icon { opacity: .48; }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user