浏览代码

第三方文章,点击时,新打开一个窗口并跳转到该地址

yellowtaotao 3 年之前
父节点
当前提交
e0cfe82f12
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 4 2
      src/views/home/learn/page-learn-child.vue
  2. 4 2
      src/views/home/learn/page-learn-recommend.vue

+ 4 - 2
src/views/home/learn/page-learn-child.vue

@@ -226,8 +226,10 @@ export default {
     },
     chooseContent(contentItem, index) {
       if (contentItem.type === "THIRD_PARTY") {
-        // window.location.href = contentItem.contents;
-        window.open(contentItem.contents);
+        if (contentItem.contents) {
+          // window.location.href = contentItem.contents;
+          window.open(contentItem.contents);
+        }
       } else {
         this.$router.push({
           name: "learn-content",

+ 4 - 2
src/views/home/learn/page-learn-recommend.vue

@@ -190,8 +190,10 @@ export default {
     onLoad() {},
     chooseContent(contentItem, index) {
       if (contentItem.type === "THIRD_PARTY") {
-        // window.location.href = contentItem.contents;
-        window.open(contentItem.contents);
+        if (contentItem.contents) {
+          // window.location.href = contentItem.contents;
+          window.open(contentItem.contents);
+        }
       } else {
         this.$router.push({
           name: "learn-content",