You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.4 KiB
74 lines
1.4 KiB
<template>
|
|
<el-select class="fontSizeSelect" v-model="fontVal" :placeholder="$t('common.choose')" @change="fontChange">
|
|
<el-option
|
|
v-for="item in fontList"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value">
|
|
<span :style="{fontSize:item.value+'px'}">{{ item.label }}</span>
|
|
</el-option>
|
|
</el-select>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'font-size-select',
|
|
props: {
|
|
fontSize: {
|
|
type: String,
|
|
default: '12'
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
fontVal: '',
|
|
fontList: [{
|
|
value: '12',
|
|
label: '12px'
|
|
}, {
|
|
value: '14',
|
|
label: '14px'
|
|
}, {
|
|
value: '16',
|
|
label: '16px'
|
|
}, {
|
|
value: '18',
|
|
label: '18px'
|
|
}, {
|
|
value: '20',
|
|
label: '20px'
|
|
}, {
|
|
value: '22',
|
|
label: '22px'
|
|
}, {
|
|
value: '24',
|
|
label: '24px'
|
|
}, {
|
|
value: '28',
|
|
label: '28px'
|
|
}, {
|
|
value: '32',
|
|
label: '32px'
|
|
}, {
|
|
value: '36',
|
|
label: '36px'
|
|
}]
|
|
}
|
|
},
|
|
mounted () {
|
|
this.fontVal = this.fontSize
|
|
},
|
|
methods: {
|
|
// 获取类别
|
|
fontChange (val) {
|
|
this.$emit('update:fontSize', val)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.fontSizeSelect{
|
|
width: 100px;
|
|
}
|
|
</style>
|