refactor: number-diff.vue to composition api

This commit is contained in:
Norm 2022-09-10 12:25:58 -04:00
parent 70c12158f7
commit ebc4daa6c2
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE

View file

@ -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>