首页 > 解决方案 > 在开发模式下为 vue 组件/模板添加检查

问题描述

我想向 vue 组件添加额外的检查。它们应该如下所示: 在此处输入图像描述

这些检查应仅在开发模式下执行。

这里有一个例子:

<template>
  <div>
    <slot />
  </div>
</template>

<script>
export default {
  name: 'FuiButton',
  props: {
    labeled: {
      type: Boolean,
    },
    labeledIcon: {
      type: Boolean,
    },
  },
};
</script>

例如,检查可能是两个属性不能同时为真。另一种类型的检查可能是:MyCompB 只能作为 MyCompA 的子项存在。

标签: vue.js

解决方案


推荐阅读