本文整理汇总了TypeScript中vue-property-decorator.Watch函数的典型用法代码示例。如果您正苦于以下问题:TypeScript Watch函数的具体用法?TypeScript Watch怎么用?TypeScript Watch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Watch函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: imageUpdater
@Watch("image", { immediate: true })
imageUpdater() {
let metaImage = document.getElementById("meta-image") as HTMLMetaElement;
if (this.image) {
metaImage.content = this.image;
} else {
metaImage.content = window.location.origin + "/img/only-logo.png";
}
}
开发者ID:pranavjindal999,项目名称:Youtube-Material,代码行数:9,代码来源:Helmet.ts
示例2: descriptionUpdater
@Watch("description", { immediate: true })
descriptionUpdater() {
let metaDescription = document.getElementById(
"meta-description"
) as HTMLMetaElement;
let metaOGDescription = document.getElementById(
"meta-og-description"
) as HTMLMetaElement;
metaOGDescription.content = this.description;
metaDescription.content = this.description;
}
开发者ID:pranavjindal999,项目名称:Youtube-Material,代码行数:12,代码来源:Helmet.ts
示例3: metaUpdator
@Watch("$route.fullPath", { immediate: true })
metaUpdator() {
let link = document.getElementById("canonical-link") as HTMLLinkElement;
let metaUrl = document.getElementById("meta-url") as HTMLMetaElement;
let metaType = document.getElementById("meta-type") as HTMLMetaElement;
let metaImage = document.getElementById("meta-image") as HTMLMetaElement;
link.href = document.location.href;
metaUrl.content = document.location.href;
if (this.$route.name === routes.video.name) {
metaType.content = "video.other";
metaImage.content = `https://img.youtube.com/vi/${
this.$route.params[routes.video.params.id]
}/hqdefault.jpg`;
} else {
metaType.content = "website";
metaImage.content = window.location.origin + "/img/only-logo.png";
}
}
开发者ID:pranavjindal999,项目名称:Youtube-Material,代码行数:20,代码来源:Helmet.ts
示例4: OnRouteChange
@Watch('$route')
OnRouteChange() {
if (this.device === DeviceType.Mobile && this.sidebar.opened) {
AppModule.CloseSideBar(false);
}
}
开发者ID:qq449245884,项目名称:fising,代码行数:6,代码来源:ResizeHandler.ts
示例5: titleUpdater
@Watch("title", { immediate: true })
titleUpdater() {
document.title = this.title ? `vTyoob - ${this.title}` : "vTyoob";
let metaTitle = document.getElementById("meta-title") as HTMLMetaElement;
metaTitle.content = document.title;
}
开发者ID:pranavjindal999,项目名称:Youtube-Material,代码行数:6,代码来源:Helmet.ts
注:本文中的vue-property-decorator.Watch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论