【问题标题】:show dialog box on mouseenter vuetify在 mouseenter vuetify 上显示对话框
【发布时间】:2020-01-30 10:37:16
【问题描述】:

我正在尝试显示一个编辑按钮,然后使用 mouseenter 和 mouseleave 打开一个单击对话框。进入编辑按钮时会显示,但一旦我点击它,它就会隐藏起来。 有人可以告诉我我在这里做错了什么。编辑按钮位于 DueDateAddM 组件内。

<v-card-title class="mx-5">{{dayjs(key).format('DD MMM YYYY')}}</v-card-title>
                <v-col v-for="(item, i) in value" :key="i">
                  <v-card-text
                    class="black--text py-0"
                    @mouseenter="item.isEdit=true"
                    @mouseleave="item.isEdit=false"
                  >
                    <v-row>
                      <span v-if="!item.isEdit" class="grey--text mr-1">#{{item.id}}</span>
                      <span
                        v-show="isLoggedIn"
                        v-if="item.isEdit"
                        class="mr-1"
                        @click="editDuedate"
                      >
                        <DuedateAddM :propItem="item" :duedateId="item.id" />
                      </span>
                      {{item.descp}}
                      <v-tooltip top>
                        <template v-slot:activator="{ on }">
                          <v-chip class="mx-1 py-0" small label v-on="on" v-if="item.previousdate">
                            <v-icon color="grey" small class="mr-1">fas fa-info-circle</v-icon>
                            <span>{{dayjs(item.previousdate).format("DD MMM YYYY")}}</span>
                            <span v-if="!item.previousdate">No Previous date found</span>
                          </v-chip>
                        </template>
                        <span>Previous Duedate</span>
                      </v-tooltip>
                      <v-tooltip top>
                        <template v-slot:activator="{ on }">
                          <v-chip small v-on="on" class="mx-1">
                            <v-icon color="grey" small class="mr-1">fas fa-tag</v-icon>
                            {{item.category}}
                          </v-chip>
                        </template>
                        <span>Category</span>
                      </v-tooltip>
                      <v-tooltip top>
                        <template v-slot:activator="{ on }">
                          <v-chip color="red lighten-4" small class="mx-1" v-on="on">
                            <v-icon color="grey" small class="mr-1">fas fa-map-marker-alt</v-icon>
                            {{item.region}}
                          </v-chip>
                        </template>
                        <span>Region</span>
                      </v-tooltip>
                    </v-row>
                    <v-row v-if="item.applicableto">
                      <v-subheader class="ml-1">Applicable To: "{{item.applicableto}}"</v-subheader>
                    </v-row>
                    <v-divider class="mt-2"></v-divider>
                  </v-card-text>
                </v-col>

【问题讨论】:

标签: vue.js vuetify.js


【解决方案1】:

使用 v-show 代替 v-if

                      <span v-show="!item.isEdit" class="grey--text mr-1">#{{item.id}}</span>
                      <span
                        v-show="isLoggedIn"
                        v-show="item.isEdit"
                        class="mr-1"
                        @click="editDuedate"
                      >
                        <DuedateAddM :propItem="item" :duedateId="item.id" />
                      </span>

【讨论】:

    猜你喜欢
    • 2021-09-12
    • 1970-01-01
    • 2017-11-10
    • 1970-01-01
    • 1970-01-01
    • 2021-03-08
    • 2015-11-15
    • 2021-02-06
    • 1970-01-01
    相关资源
    最近更新 更多