mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 04:53:31 +08:00
数学计算添加进制转换
This commit is contained in:
@@ -148,6 +148,8 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
runCommand() {
|
||||
if (!this.localCommand.code)
|
||||
return quickcommand.showMessageBox("请检查参数是否正确", "info");
|
||||
// 创建一个带临时变量的命令副本
|
||||
const tempCommand = {
|
||||
...this.localCommand,
|
||||
|
@@ -1,21 +1,32 @@
|
||||
<template>
|
||||
<div class="button-group">
|
||||
<div
|
||||
v-for="opt in options"
|
||||
:key="opt.value"
|
||||
:class="['button-item', { active: modelValue === opt.value }]"
|
||||
@click="$emit('update:modelValue', opt.value)"
|
||||
>
|
||||
{{ opt.label }}
|
||||
<component
|
||||
:is="!!label ? 'BorderLabel' : 'div'"
|
||||
:label="label"
|
||||
:icon="icon"
|
||||
:model-value="isCollapse"
|
||||
>
|
||||
<div class="button-group">
|
||||
<div
|
||||
v-for="opt in options"
|
||||
:key="opt.value"
|
||||
:class="['button-item', { active: modelValue === opt.value }]"
|
||||
@click="$emit('update:modelValue', opt.value)"
|
||||
>
|
||||
{{ opt.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
import BorderLabel from "./BorderLabel.vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ButtonGroup",
|
||||
components: {
|
||||
BorderLabel,
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
required: true,
|
||||
@@ -24,6 +35,18 @@ export default defineComponent({
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
isCollapse: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
});
|
||||
|
@@ -314,22 +314,23 @@ export const mathCommands = {
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.math.conversion.decimal",
|
||||
label: "单位换算",
|
||||
desc: "数学单位换算",
|
||||
value: "quickcomposer.math.conversion.base",
|
||||
label: "进制转换",
|
||||
desc: "数字进制转换",
|
||||
icon: "swap_horiz",
|
||||
config: [
|
||||
{
|
||||
key: "value",
|
||||
label: "数值",
|
||||
component: "NumberInput",
|
||||
component: "VariableInput",
|
||||
icon: "pin",
|
||||
width: 12,
|
||||
defaultValue: newVarInputVal("var", ""),
|
||||
},
|
||||
{
|
||||
key: "from",
|
||||
label: "从",
|
||||
component: "q-select",
|
||||
component: "ButtonGroup",
|
||||
icon: "input",
|
||||
width: 6,
|
||||
options: [
|
||||
@@ -337,14 +338,13 @@ export const mathCommands = {
|
||||
{ label: "二进制", value: "binary" },
|
||||
{ label: "八进制", value: "octal" },
|
||||
{ label: "十六进制", value: "hex" },
|
||||
{ label: "度", value: "degrees" },
|
||||
{ label: "弧度", value: "radians" },
|
||||
],
|
||||
defaultValue: "decimal",
|
||||
},
|
||||
{
|
||||
key: "to",
|
||||
label: "到",
|
||||
component: "q-select",
|
||||
component: "ButtonGroup",
|
||||
icon: "output",
|
||||
width: 6,
|
||||
options: [
|
||||
@@ -352,9 +352,8 @@ export const mathCommands = {
|
||||
{ label: "二进制", value: "binary" },
|
||||
{ label: "八进制", value: "octal" },
|
||||
{ label: "十六进制", value: "hex" },
|
||||
{ label: "度", value: "degrees" },
|
||||
{ label: "弧度", value: "radians" },
|
||||
],
|
||||
defaultValue: "hex",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
Reference in New Issue
Block a user