xiaosi
1 year ago
6 changed files with 77 additions and 2 deletions
@ -1,3 +1,4 @@ |
|||
APP_TITLE=云端无人机管理系统 |
|||
APP_ICON_URL=//at.alicdn.com/t/c/font_4349903_2p0gyrtbo2.js |
|||
APP_DEVELOPMENT_BASE_URL=/api |
|||
APP_PRODUCTION_BASE_URL=/ |
|||
|
@ -0,0 +1,22 @@ |
|||
<script setup> |
|||
import { computed } from 'vue'; |
|||
|
|||
const props = defineProps({ |
|||
name: { |
|||
type: String, |
|||
required: true, |
|||
}, |
|||
size: String, |
|||
}); |
|||
|
|||
const className = computed(() => { |
|||
const { [props.size]: cn } = { small: 't-size-s', medium: 't-size-m', large: 't-size-l' }; |
|||
return cn; |
|||
}); |
|||
</script> |
|||
|
|||
<template> |
|||
<svg :class="['t-icon', className, name]" :style="!className ? `font-size: ${size}` : ''"> |
|||
<use :href="`#${name}`" /> |
|||
</svg> |
|||
</template> |
@ -0,0 +1,49 @@ |
|||
import { h } from 'vue'; |
|||
import app from '@/app'; |
|||
import FontIcon from '@/components/FontIcon.vue'; |
|||
|
|||
app.component('FontIcon', FontIcon); |
|||
|
|||
// 给数值加单位(可给单位套上html标签)
|
|||
// 如:<ValueUnit unit="亩">100.00</ValueUnit>(结果为:100.00亩)
|
|||
// 如:<ValueUnit unit="亩" tag="em">100.00</ValueUnit>(结果为:100.00<em>亩</em>)
|
|||
app.component('ValueUnit', { |
|||
props: { |
|||
unit: { |
|||
type: String, |
|||
required: true, |
|||
}, |
|||
tag: { |
|||
type: String, |
|||
default: '', |
|||
}, |
|||
falsy: { |
|||
type: String, |
|||
default: '-', |
|||
}, |
|||
}, |
|||
render(self) { |
|||
const [{ children }] = self?.$slots?.default() || []; |
|||
const { unit, tag, falsy } = self?.$props || {}; |
|||
return (children || children === 0 ? [children, tag ? h(tag, unit) : unit] : falsy); |
|||
}, |
|||
}); |
|||
|
|||
/** |
|||
* 数据分配器 |
|||
* 将载荷数据payload,通过scopedSlot分配给子节点使用 |
|||
* 示例1:<DataDispatcher :payload="true" v-slot="isShow">{{ isShow }}</DataDispatcher> |
|||
* 示例2:<DataDispatcher :payload="[1, 2]" v-slot="[a, b]">{{ a }}{{ b }}</DataDispatcher> |
|||
* 示例3:<DataDispatcher :payload="{ a: 1, b: 2 }" v-slot="{ a: A, b: B }">{{ A }}{{ B }}</DataDispatcher> |
|||
*/ |
|||
app.component('DataDispatcher', { |
|||
props: { |
|||
payload: { |
|||
type: [Boolean, Number, String, Array, Object], |
|||
required: true, |
|||
}, |
|||
}, |
|||
render(self) { |
|||
return self?.$slots?.default(self.payload); |
|||
}, |
|||
}); |
Loading…
Reference in new issue