mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
函数标签支持拖动排序
This commit is contained in:
parent
ab0ab8a7a4
commit
0094cb6c29
@ -23,38 +23,47 @@
|
|||||||
narrow-indicator
|
narrow-indicator
|
||||||
outside-arrows
|
outside-arrows
|
||||||
>
|
>
|
||||||
<template v-for="flow in subFlows" :key="flow.id">
|
<draggable
|
||||||
<q-tab :name="flow.id" class="flow-tab" no-caps>
|
v-model="subFlows"
|
||||||
<div class="flow-tab-content">
|
:animation="150"
|
||||||
<template v-if="flow.isEditing">
|
item-key="id"
|
||||||
<q-input
|
tag="div"
|
||||||
v-model="flow.label"
|
class="row no-wrap"
|
||||||
|
handle=".flow-tab-content"
|
||||||
|
>
|
||||||
|
<template #item="{ element: flow }">
|
||||||
|
<q-tab :name="flow.id" class="flow-tab" no-caps>
|
||||||
|
<div class="flow-tab-content">
|
||||||
|
<template v-if="flow.isEditing">
|
||||||
|
<q-input
|
||||||
|
v-model="flow.label"
|
||||||
|
dense
|
||||||
|
borderless
|
||||||
|
class="flow-name-input"
|
||||||
|
@keydown.space.prevent
|
||||||
|
@blur="finishEdit(flow)"
|
||||||
|
@keyup.enter="finishEdit(flow)"
|
||||||
|
ref="inputRefs"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span class="flow-name-text" @dblclick="startEdit(flow)">{{
|
||||||
|
flow.label
|
||||||
|
}}</span>
|
||||||
|
</template>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
dense
|
dense
|
||||||
borderless
|
round
|
||||||
class="flow-name-input"
|
icon="close"
|
||||||
@keydown.space.prevent
|
size="xs"
|
||||||
@blur="finishEdit(flow)"
|
@click.stop="removeFlow(flow)"
|
||||||
@keyup.enter="finishEdit(flow)"
|
|
||||||
ref="inputRefs"
|
|
||||||
/>
|
/>
|
||||||
</template>
|
</div>
|
||||||
<template v-else>
|
<q-tooltip> 双击修改名称,拖动排序 </q-tooltip>
|
||||||
<span class="flow-name-text" @dblclick="startEdit(flow)">{{
|
</q-tab>
|
||||||
flow.label
|
</template>
|
||||||
}}</span>
|
</draggable>
|
||||||
</template>
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
dense
|
|
||||||
round
|
|
||||||
icon="close"
|
|
||||||
size="xs"
|
|
||||||
@click.stop="removeFlow(flow)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<q-tooltip> 双击修改名称 </q-tooltip>
|
|
||||||
</q-tab>
|
|
||||||
</template>
|
|
||||||
</q-tabs>
|
</q-tabs>
|
||||||
|
|
||||||
<q-icon dense name="add" class="add-btn" @click="addFlow" />
|
<q-icon dense name="add" class="add-btn" @click="addFlow" />
|
||||||
@ -84,18 +93,20 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineComponent, provide, reactive } from "vue";
|
import { defineComponent, provide, ref } from "vue";
|
||||||
import ComposerFlow from "./ComposerFlow.vue";
|
import ComposerFlow from "./ComposerFlow.vue";
|
||||||
import ComposerButtons from "./flow/ComposerButtons.vue";
|
import ComposerButtons from "./flow/ComposerButtons.vue";
|
||||||
import { generateCode } from "js/composer/generateCode";
|
import { generateCode } from "js/composer/generateCode";
|
||||||
import { findCommandByValue } from "js/composer/composerConfig";
|
import { findCommandByValue } from "js/composer/composerConfig";
|
||||||
import { generateUniqSuffix } from "js/composer/variableManager";
|
import { generateUniqSuffix } from "js/composer/variableManager";
|
||||||
|
import draggable from "vuedraggable";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "FlowTabs",
|
name: "FlowTabs",
|
||||||
components: {
|
components: {
|
||||||
ComposerFlow,
|
ComposerFlow,
|
||||||
ComposerButtons,
|
ComposerButtons,
|
||||||
|
draggable,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
showCloseButton: {
|
showCloseButton: {
|
||||||
@ -104,9 +115,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const subFlows = reactive([]);
|
const subFlows = ref([]);
|
||||||
const getCurrentFunctions = () => {
|
const getCurrentFunctions = () => {
|
||||||
return subFlows.map((flow) => {
|
return subFlows.value.map((flow) => {
|
||||||
return {
|
return {
|
||||||
label: flow.label,
|
label: flow.label,
|
||||||
value: flow.name,
|
value: flow.name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user