批量启用禁用

This commit is contained in:
fofolee 2022-04-03 21:18:50 +08:00
parent ec82130469
commit fcc83a0955
2 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,10 @@
<template> <template>
<!-- mini 模式下如果命令未启用或者不可直接运行则隐藏卡片面板 --> <!-- mini 模式下如果命令未启用或者不可直接运行则隐藏卡片面板 -->
<div class="wrapper" v-show="!cardStyleVars.hideCard"> <div
class="wrapper"
v-show="!cardStyleVars.hideCard"
:id="commandInfo.features.code"
>
<div> <div>
<!-- mini 模式下不显示各类按钮 --> <!-- mini 模式下不显示各类按钮 -->
<div v-show="cardStyleVars.showButtons"> <div v-show="cardStyleVars.showButtons">
@ -10,6 +14,7 @@
v-model="isCommandActivated" v-model="isCommandActivated"
checked-icon="flash_on" checked-icon="flash_on"
color="orange-6" color="orange-6"
@click="toggleCommandActivated"
/> />
</div> </div>
<!-- 选项按钮 --> <!-- 选项按钮 -->
@ -175,7 +180,6 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
@ -192,11 +196,6 @@ export default {
}, },
}; };
}, },
watch: {
isCommandActivated() {
this.toggleCommandActivated();
},
},
computed: { computed: {
// //
cardStyleVars() { cardStyleVars() {
@ -238,7 +237,7 @@ export default {
cardStyle: Object, cardStyle: Object,
}, },
mounted() { mounted() {
console.log(this.commandInfo.features.code, this); // console.log(this.commandInfo.features.code, this);
}, },
methods: { methods: {
// //

View File

@ -67,7 +67,6 @@
<CommandCard <CommandCard
v-for="commandInfo in currentTagQuickCommands" v-for="commandInfo in currentTagQuickCommands"
:key="commandInfo.features.code" :key="commandInfo.features.code"
:ref="commandInfo.features.code"
:commandInfo="commandInfo" :commandInfo="commandInfo"
:activated=" :activated="
activatedQuickCommandFeatureCodes.includes( activatedQuickCommandFeatureCodes.includes(
@ -494,7 +493,7 @@ export default {
this.currentTag = !tags || !tags.length ? "未分类" : tags[0]; this.currentTag = !tags || !tags.length ? "未分类" : tags[0];
// dom // dom
this.$nextTick(() => { this.$nextTick(() => {
this.$refs[code][0].$el.nextElementSibling.scrollIntoViewIfNeeded(); document.getElementById(code).scrollIntoViewIfNeeded();
}); });
}, },
// //
@ -569,15 +568,17 @@ export default {
}, },
// //
enableAllCommands() { enableAllCommands() {
for (var key in this.$refs) { // dom
this.$refs[key][0].isCommandActivated = true; document
} .querySelectorAll(".q-toggle[aria-checked='false']")
.forEach((x) => x.click());
}, },
// //
disableAllCommands() { disableAllCommands() {
for (var key in this.$refs) { // dom
this.$refs[key][0].isCommandActivated = false; document
} .querySelectorAll(".q-toggle[aria-checked='true']")
.forEach((x) => x.click());
}, },
}, },
}; };