NameSetting.vue
1.1 KB
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
<template>
<setting-item-box :name="t('common.nameText')" :alone="true">
<n-input
type="text"
maxlength="12"
minlength="1"
:placeholder="t('external.customized.placeChart')"
size="small"
clearable
show-count
v-model:value="i18nChartConfigTitle"
@focus="handleFocus"
@blur="handleBlur"
></n-input>
</setting-item-box>
</template>
<script setup lang="ts">
import { PropType, ref, onMounted } from 'vue'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { ConfigType } from '@/packages/index.d'
const props = defineProps({
chartConfig: {
type: Object as PropType<ConfigType>,
required: true
},
})
const t = window['$t']
const i18nChartConfigTitle = ref('')
onMounted(()=>{
i18nChartConfigTitle.value = t(props.chartConfig.title)
})
let valueCatch = ''
const handleFocus = () => {
valueCatch = props.chartConfig.title
}
const handleBlur = () => {
if(!props.chartConfig.title.length) {
window['$message'].warning(t('external.customized.textRule1'))
props.chartConfig.title = valueCatch
}
}
</script>