<template>
<component
:is="type === 'internal' ? 'router-link' : 'a'"
:to="type === 'internal' ? link : null"
:href="type !== 'internal' ? link : null"
>
<slot />
</component>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
@Component
export default class SiteLink extends Vue {
@Prop({
validator: (value: string) =>
["external", "internal"].includes(value)
})
private readonly type!: string;
@Prop({ type: String })
private readonly link!: string;
}
</script>
Run Code Online (Sandbox Code Playgroud)
上面是一个 Vue 组件,它将在其中呈现一个链接。我已经删除了与问题无关的任何内容(即rel、target、class等)。
理解- 我对 …
在执行 npm 安装时,我正在努力找出 Azure 管道的以下两个片段之间的差异。
片段 1(使用任务):
- task: Npm@1
inputs:
command: 'install'
Run Code Online (Sandbox Code Playgroud)
片段 2(使用脚本):
- script: npm install
Run Code Online (Sandbox Code Playgroud)
我唯一的猜测是一个比另一个性能更好?另外,是否推荐一种方法而不是另一种方法?