调整三种视图的样式

This commit is contained in:
fofolee 2022-04-03 11:42:08 +08:00
parent a8b15d11d6
commit df9619cac0

View File

@ -2,11 +2,12 @@
<!-- mini 模式下如果命令未启用或者不可直接运行则隐藏卡片面板 --> <!-- mini 模式下如果命令未启用或者不可直接运行则隐藏卡片面板 -->
<div <div
class="wrapper" class="wrapper"
v-show="!(cardStyle.code === 1 && (!isCommandActivated || !canCommandRun))" v-show="!cardStyleVars.hideCard"
:id="commandInfo.features.code"
> >
<div> <div>
<!-- mini 模式下不显示各类按钮 --> <!-- mini 模式下不显示各类按钮 -->
<div v-show="cardStyle.code > 1"> <div v-show="cardStyleVars.showButtons">
<!-- 开关 --> <!-- 开关 -->
<div class="absolute" style="z-index: 1; left: 20px; bottom: 16px"> <div class="absolute" style="z-index: 1; left: 20px; bottom: 16px">
<q-toggle <q-toggle
@ -61,24 +62,24 @@
<q-card v-ripple :style="isCommandActivated ? '' : 'color:grey'"> <q-card v-ripple :style="isCommandActivated ? '' : 'color:grey'">
<q-card-section> <q-card-section>
<!-- logo --> <!-- logo -->
<div class="row"> <div class="row" :class="cardStyleVars.logoPosition">
<q-img width="48px" :src="commandInfo.features.icon" /> <q-img width="48px" :src="commandInfo.features.icon" />
</div> </div>
<!-- 名称 --> <!-- 名称 -->
<!-- mini small 模式下命令标题字体变小 --> <!-- mini small 模式下命令标题字体变小 -->
<div class="row justify-end"> <div :class="'row ' + cardStyleVars.fontPosition">
<div <div
class="ellipsis" class="ellipsis"
:style="{ :style="{
fontSize: cardStyle.code > 2 ? '1.25rem' : '1.1rem', fontSize: cardStyleVars.showBiggerTitle ? '1.25rem' : '1.1rem',
}" }"
> >
{{ commandInfo.features.explain }} {{ commandInfo.features.explain }}
</div> </div>
</div> </div>
<!-- 匹配模式 --> <!-- 匹配模式 -->
<div class="row justify-end q-gutter-xs"> <div class="row">
<div class="matchTypesBox"> <div :class="'matchTypesBox flex q-gutter-xs ' + cardStyleVars.fontPosition">
<span v-for="cmd in commandInfo.features.cmds" :key="cmd"> <span v-for="cmd in commandInfo.features.cmds" :key="cmd">
<span v-if="typeof cmd === 'string'"> <span v-if="typeof cmd === 'string'">
<q-badge rounded :color="cmdBadgeColor()" <q-badge rounded :color="cmdBadgeColor()"
@ -150,7 +151,7 @@
<!-- 语言类型 --> <!-- 语言类型 -->
<div <div
class="row justify-end items-center q-gutter-xs" class="row justify-end items-center q-gutter-xs"
v-show="cardStyle.code > 1" v-show="cardStyleVars.showLanguages"
> >
<span :style="'color:' + allProgrammings[commandInfo.program].color" <span :style="'color:' + allProgrammings[commandInfo.program].color"
></span ></span
@ -158,7 +159,7 @@
<span class="text-subtitle2">{{ commandInfo.program }}</span> <span class="text-subtitle2">{{ commandInfo.program }}</span>
<!-- mini small 模式下不显示适配系统 --> <!-- mini small 模式下不显示适配系统 -->
<!-- 适配系统 --> <!-- 适配系统 -->
<div class="flex" v-show="cardStyle.code > 2"> <div class="flex" v-show="cardStyleVars.showPlatforms">
|&nbsp; |&nbsp;
<img <img
width="16" width="16"
@ -195,12 +196,30 @@ export default {
}; };
}, },
computed: { computed: {
// //
cardStyleVars() {
return {
showButtons: this.cardStyle.code > 1,
showPlatforms: this.cardStyle.code > 2,
showLanguages: this.cardStyle.code > 1,
showBiggerTitle: this.cardStyle.code > 2,
logoPosition:
this.cardStyle.code > 1 ? "justify-start" : "justify-center",
fontPosition:
this.cardStyle.code > 1 ? "justify-end" : "justify-center",
hideCard:
this.cardStyle.code === 1 &&
(!this.isCommandActivated || !this.canCommandRun),
};
},
// , cmds cmds[0]
canCommandRun() { canCommandRun() {
return ( //
this.commandInfo.features.cmds.filter((x) => x.length).length && if (!this.isCommandActivated) return false;
this.isCommandActivated let cmd = this.commandInfo.features.cmds[0];
); //
if (cmd.type && cmd.type === "window") return false;
return true;
}, },
// //
cmdBadgeColor() { cmdBadgeColor() {
@ -302,7 +321,7 @@ export default {
} }
.matchTypesBox { .matchTypesBox {
height: 23px; height: 23px;
width: 80%; width: 100%;
overflow: hidden; overflow: hidden;
text-align: right; text-align: right;
} }