zhengyiming
2025-02-10 958b79ed89b9e742540f714a80261d222c0fc09b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
  <div class="input-number-with-extra">
    <ProFormInputNumber v-model="innerModelValue" v-bind="$attrs"></ProFormInputNumber>
    <div class="input-number-with-extra-wrapper" v-if="showExtra">{{ extra }}</div>
  </div>
</template>
 
<script setup lang="ts">
import { ProFormInputNumber } from '@bole-core/components';
 
defineOptions({
  name: 'NumberInputWithExtra',
});
 
type Props = {
  modelValue: number | null;
  showExtra: boolean;
  extra: string;
};
 
const props = withDefaults(defineProps<Props>(), {
  showExtra: false,
});
 
const emit = defineEmits<{
  (e: 'update:modelValue', val: string | number): void;
}>();
 
const innerModelValue = computed({
  get() {
    return props.modelValue;
  },
  set(val) {
    emit('update:modelValue', val);
  },
});
</script>
 
<style lang="scss" scoped>
@use '@/style/common.scss' as *;
 
.input-number-with-extra {
  display: flex;
  margin-bottom: 18px;
  width: 100%;
 
  .input-number-with-extra-wrapper {
    margin-left: 10px;
  }
}
</style>