我正在尝试构建一个自定义的收集界面,如果用户单击“重新加载”按钮,则应“刷新”该项目的内容。这可能吗?
我在JS中看到有一个this.api,可以在其中调用API函数,但是我不确定如何为当前收集项重新加载数据。
有什么建议吗?
display.vue
<template>
<div>
<button @click="noClick">
<v-icon
v-tooltip="Execute"
class="material-icons select"
name="play_arrow"
/>
</button>
<button @click="noClick">
<v-icon v-tooltip="Execute" class="material-icons select" name="replay" />
</button>
</div>
</template>
<script>
import mixin from "@directus/extension-toolkit/mixins/interface";
export default {
mixins: [mixin],
data: {
count: 0,
},
computed: {
now: function() {
console.log(this);
return Date.now();
},
displayValue() {
return "uolo";
if (this.value) return this.value.toLowerCase();
},
},
methods: {
warn: function(message, event) {
// now we have access to the native event
if (event) {
event.stopPropagation();
event.preventDefault();
}
},
noClick: function(event) {
// now we have access to the native event
if (event) {
event.stopPropagation();
event.preventDefault();
}
debugger;
},
},
};
</script>
<style lang="scss" scoped>
div {
background-color: var(--gray-300);
border-radius: var(--border-radius);
}
</style>
答案 0 :(得分:1)
没有官方的方法来触发页面刷新。
尽管有点骇人听闻,但最好的选择是使用this.$parent
入侵父树,并在到达getItems()
组件后调用v-items
{ {3}}