对话框添加ESC关闭

This commit is contained in:
fangxiang 2022-01-25 19:41:28 +08:00
parent 1b9ead59b9
commit 486aa81473
19 changed files with 212 additions and 21 deletions

View File

@ -1,5 +1,14 @@
<template>
<q-dialog v-model="show_dialog">
<q-dialog
v-model="show_dialog"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,14 @@
<template>
<q-dialog v-model="show_dialog">
<q-dialog
v-model="show_dialog"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card
class="overflow-hidden"
style="overflow-y: scroll; max-width: 60vw; max-height: 40vh"

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card
class="overflow-hidden"
style="overflow-y: scroll; max-width: 60vw; max-height: 80vh"

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -4,6 +4,13 @@
v-model="show_dialog"
@show="onShow"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="max-width: 70vw">
<q-form @submit="onSubmit">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-card-section class="q-ma-none q-pa-sm">
<div class="row">

View File

@ -1,5 +1,16 @@
<template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData">
<q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm">

View File

@ -228,6 +228,9 @@ export default defineComponent({
};
const wallMouseDown = (evt: MouseEvent) => {
if (plan_running.value) {
return;
}
if (evt.ctrlKey && wall.value) {
let left =
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
@ -286,11 +289,9 @@ export default defineComponent({
$store.state.device_screen_width,
(start_y * wall_height_scaler.value) /
$store.state.device_screen_height,
(end_x *
wall_width_scaler.value) /
(end_x * wall_width_scaler.value) /
$store.state.device_screen_width,
(end_y *
wall_height_scaler.value) /
(end_y * wall_height_scaler.value) /
$store.state.device_screen_height
)
);