(如何)我应该在 Vue.js 组件(TypeScript)中使用访问修饰符(公共、私有等)吗?

jas*_*sie 6 access-modifiers typescript vue.js vuejs2 vue-class-components

我有一个 Vue.js v2.6 项目,其中包含 TypeScript v.4.3“底层”。我的问题:我找不到任何可以澄清的文档,说明在Vue 组件
中 使用是否有意义以及如何正确使用它们。 我搜索了文章、Vue.js 文档和 StackOverflow,但没有任何发现。(Vue.js 文档完全忽略了它们的存在!)access modifiers

这就是我目前在 Vue 组件中使用访问修饰符的方式:

myComponent.vue 的模板部分:

<template>
  <div>
    <!-- accessing some of the fields of the class here e.g. the getter -->
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

myComponent.vue 的脚本部分:

<script lang="ts">
  import { Vue, Component, Prop, Emit } from "vue-property-decorator";

  @Component()
  export default class MyComponent extends Vue {
    @Prop() public readonly myPropertyVariable!: boolean;

    public myVariable!: string; // accessed in template

    private myInternalVariable!: boolean; // not accessed in template

    public get myGetterVariable(): string {
       // obviously accessed in template (getter)
    }

    @Emit()
    public change(): void {}

    @Action
    public doAction(): void {}

    public mounted(): void {}

    public myMethod(): boolean {
      // accessed in template
    }

    private myInternalMethod(): boolean {
      // not accessed in template
    }
  }
</script>
Run Code Online (Sandbox Code Playgroud)

我希望这不是一个基于意见的问题。我假设有一个事实可以证实 Vue 组件中访问修饰符的意义。我有一种强烈的、可能是非理性的抵制,不想把它们全部忽略。

顺便说一句:我正在 Rider 中编码,访问修饰符可能对 IDE 代码分析有用。