layui表单table渲染完成对某一行进行标记案例

      发布在:前端技术      评论:0 条评论
<pre style="background-color:#262e37;color:#ffffff;font-family:&#39;Consolas&#39;,monospace;font-size:11.3pt;"><span style="color:#4ac60a;">done</span><span style="color:#f92672;">: function </span>(<span style="color:#fd971f;font-style:italic;">res</span>, <span style="color:#fd971f;font-style:italic;">curr</span>, <span style="color:#fd971f;font-style:italic;">count</span>) {<br/> <span style="color:#f92672;">var </span><span style="color:#64a2a2;">that </span><span style="color:#f92672;">= this</span>.<span style="color:#660e7a;font-weight:bold;">elem</span>.<span style="color:#4ac60a;">next</span>();<br/> <span style="color:#fd971f;font-style:italic;">res</span>.<span style="color:#660e7a;font-weight:bold;">data</span>.<span style="color:#4ac60a;">forEach</span>(<span style="color:#f92672;">function </span>(<span style="color:#fd971f;font-style:italic;">item</span>, <span style="color:#fd971f;font-style:italic;">index</span>) {<br/> <span style="color:#f92672;">if </span>(<span style="color:#fd971f;font-style:italic;">item</span>.<span style="color:#660e7a;font-weight:bold;">id </span><span style="color:#f92672;">== </span><span style="color:#e6db74;">&quot;{:cookie(&#39;new_comment_id&#39;)}&quot;</span>) {<br/> <span style="color:#660e7a;font-weight:bold;font-style:italic;">console</span>.<span style="color:#4ac60a;">log</span>(<span style="color:#e6db74;">&quot;.layui-table-box tbody tr[data-index=&#39;&quot; </span><span style="color:#f92672;">+ </span><span style="color:#fd971f;font-style:italic;">index </span><span style="color:#f92672;">+ </span><span style="color:#e6db74;">&quot;&#39;]&quot;</span>)<br/> <span style="color:#f92672;">var </span><span style="color:#64a2a2;">tr </span><span style="color:#f92672;">= </span><span style="color:#64a2a2;">that</span>.<span style="color:#4ac60a;">find</span>(<span style="color:#e6db74;">&quot;.layui-table-box tbody tr[data-index=&#39;&quot; </span><span style="color:#f92672;">+ </span><span style="color:#fd971f;font-style:italic;">index </span><span style="color:#f92672;">+ </span><span style="color:#e6db74;">&quot;&#39;]&quot;</span>);<br/> <span style="color:#64a2a2;">tr</span>.<span style="color:#4ac60a;">css</span>(<span style="color:#e6db74;">&quot;background-color&quot;</span>, <span style="color:#e6db74;">&quot;</span><span style="color:#e6db74;background-color:#191f26;">#b2f1c3</span><span style="color:#e6db74;">&quot;</span>);<br/> }<br/> });<br/><br/>}</pre><p><br/></p>
相关文章
热门推荐