Directus自定义界面-重新加载收集条目数据

时间:2020-11-12 18:21:13

标签: directus

我正在尝试构建一个自定义的收集界面,如果用户单击“重新加载”按钮,则应“刷新”该项目的内容。这可能吗?

我在JS中看到有一个this.api,可以在其中调用API函数,但是我不确定如何为当前收集项重新加载数据。

有什么建议吗?

enter image description here

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>

1 个答案:

答案 0 :(得分:1)

没有官方的方法来触发页面刷新。

尽管有点骇人听闻,但最好的选择是使用this.$parent入侵父树,并在到达getItems()组件后调用v-items { {3}}