mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
parent
5f0e421550
commit
e1c0614265
@ -26,6 +26,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, inject, PropType } from 'vue';
|
import { computed, defineComponent, inject, PropType } from 'vue';
|
||||||
|
|
||||||
|
import { isNumber } from '@tmagic/utils';
|
||||||
|
|
||||||
import { FormState, TextConfig } from '../schema';
|
import { FormState, TextConfig } from '../schema';
|
||||||
import fieldProps from '../utils/fieldProps';
|
import fieldProps from '../utils/fieldProps';
|
||||||
import { useAddField } from '../utils/useAddField';
|
import { useAddField } from '../utils/useAddField';
|
||||||
@ -86,7 +88,7 @@ export default defineComponent({
|
|||||||
const value = props.model[modelName.value];
|
const value = props.model[modelName.value];
|
||||||
let num;
|
let num;
|
||||||
let unit;
|
let unit;
|
||||||
if (/^([0-9.]+)$/.test(value)) {
|
if (isNumber(value)) {
|
||||||
num = +value;
|
num = +value;
|
||||||
} else {
|
} else {
|
||||||
value.replace(/^([0-9.]+)([a-z%]+)$/, ($0: string, $1: string, $2: string) => {
|
value.replace(/^([0-9.]+)([a-z%]+)$/, ($0: string, $1: string, $2: string) => {
|
||||||
@ -100,7 +102,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ctrl = navigator.platform.match('Mac') ? $event.metaKey : $event.ctrlKey;
|
const ctrl = navigator.platform.match('Mac') ? $event.metaKey : $event.ctrlKey;
|
||||||
const shif = $event.shiftKey;
|
const shift = $event.shiftKey;
|
||||||
const alt = $event.altKey;
|
const alt = $event.altKey;
|
||||||
|
|
||||||
if (arrowUp) {
|
if (arrowUp) {
|
||||||
@ -108,7 +110,7 @@ export default defineComponent({
|
|||||||
num += 100;
|
num += 100;
|
||||||
} else if (alt) {
|
} else if (alt) {
|
||||||
num = (num * 10000 + 1000) / 10000;
|
num = (num * 10000 + 1000) / 10000;
|
||||||
} else if (shif) {
|
} else if (shift) {
|
||||||
num = num + 10;
|
num = num + 10;
|
||||||
} else {
|
} else {
|
||||||
num += 1;
|
num += 1;
|
||||||
@ -118,7 +120,7 @@ export default defineComponent({
|
|||||||
num -= 100;
|
num -= 100;
|
||||||
} else if (alt) {
|
} else if (alt) {
|
||||||
num = (num * 10000 - 1000) / 10000;
|
num = (num * 10000 - 1000) / 10000;
|
||||||
} else if (shif) {
|
} else if (shift) {
|
||||||
num -= 10;
|
num -= 10;
|
||||||
} else {
|
} else {
|
||||||
num -= 1;
|
num -= 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user