forked from FoundKeyGang/FoundKey
refactor: number-diff.vue to composition api
This commit is contained in:
parent
70c12158f7
commit
ebc4daa6c2
1 changed files with 8 additions and 21 deletions
|
@ -4,30 +4,17 @@
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
import number from '@/filters/number';
|
import number from '@/filters/number';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
props: {
|
value: number;
|
||||||
value: {
|
}>();
|
||||||
type: Number,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
setup(props) {
|
|
||||||
const isPlus = computed(() => props.value > 0);
|
const isPlus = computed(() => props.value > 0);
|
||||||
const isMinus = computed(() => props.value < 0);
|
const isMinus = computed(() => props.value < 0);
|
||||||
const isZero = computed(() => props.value === 0);
|
const isZero = computed(() => props.value === 0);
|
||||||
return {
|
|
||||||
isPlus,
|
|
||||||
isMinus,
|
|
||||||
isZero,
|
|
||||||
number,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue