當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vue-property-decorator.Watch函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。