英文:
v-overlay gets disabled when I click anywhere on the screen
问题
I have an app.vue that comprises of multiple components. One of the components has an overlay on it with a button that should disable the overlay and make the contents visible once clicked. However instead of the button the overlay gets disabled once I click anywhere on the screen.
如果我从数据部分删除我的overlay属性,就不会显示任何覆盖层:
import axios from 'axios'
// import StrategyProvider from "../lib/strategy.js";
import { ref } from 'vue'
const strategies = ref([{}, {}])
const overlay = ref(true)
const setOverlay = v => (overlay.value = v)
export default {
// props: ["strategies"],
data: function() {
return {
overlay: true,
strategies: []
};
},
英文:
I have an app.vue that comprises of multiple components. One of the components has an overlay on it with a button that should disable the overlay and make the contents visible once clicked. However instead of the button the overlay gets disable once I click anywhere on the screen.
template>
<v-card>
<v-row>
<v-overlay opacity="0.88" :absolute="true" :model-value="overlay" contained>
<v-btn color="warning" @click="disenable(false)">No Automation</v-btn>
</v-overlay>
</v-row>
<v-toolbar flat dense color="indigo" style="height: 80px;">
<v-toolbar-title style="padding-top: 40px;">
Active Strategies
</v-toolbar-title>
</v-toolbar>
<v-divider class="mx-4"></v-divider>
<v-table fixed-header height="auto">
<thead>
<tr>
<th class="text-left">Assetpair</th>
<th class="text-left">Strategy</th>
<th class="text-left">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="row in strategies" v-bind:key="row.ticker">
<td>{{ row.assetpair }}</td>
<td>{{ row.strategy }}</td>
<td>
<div class="text-left">
<v-chip class="ma-2" color="red" dark @click="stopStrategy(127)">
<v-icon left>mdi-server-plus</v-icon>Stop Strategy
</v-chip>
</div>
</td>
</tr>
</tbody>
</v-table>
</v-card>
</template>
<script>
If I remove my overlay prop from the data section no overlay gets displayed:
import axios from 'axios'
// import StrategyProvider from "../lib/strategy.js";
import { ref } from 'vue'
const strategies = ref([{}, {}])
const overlay = ref(true)
const setOverlay = v => (overlay.value = v)
export default {
// props: ["strategies"],
data: function() {
return {
overlay: true,
strategies: []
};
},
答案1
得分: 1
它关闭是因为你点击了背景。请查看 :persistent
属性:
> 点击元素外部或按下 esc 键不会使其停用。
英文:
It closes because you are clicking on the background. Have a look at the :persistent
prop:
>Clicking outside of the element or pressing esc key will not deactivate it.
Here is a playground
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论