最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

使用JavaScript合并行

IT培训 admin 8浏览 0评论

使用JavaScript合并行

这是分类模式:

var mongoose = require("mongoose");

var categorySchema = new mongoose.Schema({
    name:String,
    image:String,
    description:String,
    series: [
      {
         type: mongoose.Schema.Types.ObjectId,
         ref: "Series"
      }
     ]
});

module.exports= mongoose.model("Category",categorySchema);
回答如下:

据我所看到的,你真的没有与他们平等的内容行。他们要么在第一列或在两个不同的。总之,在我看来,如果你想尝试,如果它们的内容是在第二列等于行结合起来。

如果它是确定松散的第一列内的信息,你要直接跳过整个行。只要您呈现<tr>之前挪动了比较。不要忘记,你必须使第一行中的任何情况。例如:

<table class="table">
    <thread>
        <tr>
          <th scope="col" class="mytable">Series Name</th>
          <th scope="col" class="mytable">Series Application</th>
        </tr>
    </thread>
    <tbody>
        <% for(var i = 0; i < series.length; i++){ %>
            <% if(i < 1){ %>
            <tr>
                <td>
                    <strong>
                        <a href="/categories/<%=Category._id%>/series/<%=series[i]._id%>/products"><%=series[i].name%>
                        </a>
                    </strong>
                </td>
                <td>
                    <em><%=series[i].application%></em>
                </td>
            </tr>
            <% } else if(series[i-1].application !== series[i].application){ %>
            <tr>
                <td>
                    <strong>
                        <a href="/categories/<%=Category._id%>/series/<%=series[i]._id%>/products"><%=series[i].name%>
                        </a>
                    </strong>
                </td>
                <td>
                    <em><%=series[i].application%></em>
                </td>
            </tr>
            <% }; %>
        <% } %>
    </tbody>
</table>

使用JavaScript合并行

这是分类模式:

var mongoose = require("mongoose");

var categorySchema = new mongoose.Schema({
    name:String,
    image:String,
    description:String,
    series: [
      {
         type: mongoose.Schema.Types.ObjectId,
         ref: "Series"
      }
     ]
});

module.exports= mongoose.model("Category",categorySchema);
回答如下:

据我所看到的,你真的没有与他们平等的内容行。他们要么在第一列或在两个不同的。总之,在我看来,如果你想尝试,如果它们的内容是在第二列等于行结合起来。

如果它是确定松散的第一列内的信息,你要直接跳过整个行。只要您呈现<tr>之前挪动了比较。不要忘记,你必须使第一行中的任何情况。例如:

<table class="table">
    <thread>
        <tr>
          <th scope="col" class="mytable">Series Name</th>
          <th scope="col" class="mytable">Series Application</th>
        </tr>
    </thread>
    <tbody>
        <% for(var i = 0; i < series.length; i++){ %>
            <% if(i < 1){ %>
            <tr>
                <td>
                    <strong>
                        <a href="/categories/<%=Category._id%>/series/<%=series[i]._id%>/products"><%=series[i].name%>
                        </a>
                    </strong>
                </td>
                <td>
                    <em><%=series[i].application%></em>
                </td>
            </tr>
            <% } else if(series[i-1].application !== series[i].application){ %>
            <tr>
                <td>
                    <strong>
                        <a href="/categories/<%=Category._id%>/series/<%=series[i]._id%>/products"><%=series[i].name%>
                        </a>
                    </strong>
                </td>
                <td>
                    <em><%=series[i].application%></em>
                </td>
            </tr>
            <% }; %>
        <% } %>
    </tbody>
</table>

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论