update config

This commit is contained in:
Fine 2022-11-09 22:41:37 +08:00
parent 09646c0d69
commit ebb627f198
3 changed files with 9 additions and 7 deletions

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { LegendOptions } from "@/types/dashboard"; import { LegendOptions } from "@/types/dashboard";
import { isUnDef } from "@/utils/is"; import { isDef } from "@/utils/is";
export default function useLegendProcess(legend?: LegendOptions) { export default function useLegendProcess(legend?: LegendOptions) {
let isRight = false; let isRight = false;
@ -23,7 +23,7 @@ export default function useLegendProcess(legend?: LegendOptions) {
isRight = true; isRight = true;
} }
function showEchartsLegend(keys: string[]) { function showEchartsLegend(keys: string[]) {
if (legend && isUnDef(legend.show)) { if (legend && isDef(legend.show)) {
if (legend.asTable && legend.show) { if (legend.asTable && legend.show) {
return false; return false;
} }

View File

@ -21,7 +21,7 @@ export function is(val: unknown, type: string): boolean {
} }
export function isDef<T = unknown>(val?: T): val is T { export function isDef<T = unknown>(val?: T): val is T {
return typeof val === "undefined"; return typeof val !== "undefined";
} }
export function isUnDef<T = unknown>(val?: T): val is T { export function isUnDef<T = unknown>(val?: T): val is T {

View File

@ -23,15 +23,17 @@ limitations under the License. -->
/> />
</div> </div>
<div> <div>
<span class="label">{{ t("legendOptions") }}</span> <span class="label">{{ t("asTable") }}</span>
<span class="title mr-5">{{ t("asTable") }}</span>
<el-switch <el-switch
v-model="legend.asTable" v-model="legend.asTable"
active-text="Yes" active-text="Yes"
inactive-text="No" inactive-text="No"
@change="updateLegendConfig({ asTable: legend.asTable })" @change="updateLegendConfig({ asTable: legend.asTable })"
/> />
<span class="title ml-20 mr-5">{{ t("toTheRight") }}</span> </div>
<div v-show="legend.asTable">
<span class="label">{{ t("legendOptions") }}</span>
<span class="title mr-5">{{ t("toTheRight") }}</span>
<el-switch <el-switch
v-model="legend.toTheRight" v-model="legend.toTheRight"
active-text="Yes" active-text="Yes"
@ -47,7 +49,7 @@ limitations under the License. -->
@change="updateLegendConfig({ width: legend.width })" @change="updateLegendConfig({ width: legend.width })"
/> />
</div> </div>
<div> <div v-show="legend.asTable">
<span class="label">{{ t("legendValues") }}</span> <span class="label">{{ t("legendValues") }}</span>
<span class="title mr-5">{{ t("min") }}</span> <span class="title mr-5">{{ t("min") }}</span>
<el-switch <el-switch