我对MVVM的理解!

原创 2018-12-27 14:58:25 156
摘要:m MODELV VIEWVM js版本的控制器。$(function(){    var video_title = "<%= @video.title %>";    video_title = video_title.replace("$(dizhi)",dizhi);    $(

m MODEL

V VIEW

VM js版本的控制器。

$(function(){

    var video_title = "<%= @video.title %>";

    video_title = video_title.replace("$(dizhi)",dizhi);

    $('#videoDiv h3').html(setString(video_title, 18));

    $('#videoDiv .view_num').prepend("2018-11-28&nbsp;·&nbsp;");

    $('#videoDiv .view_num span').html((Math.random()*(10-100) + 100).toFixed(1));

    $('#videoDiv p').html(parseInt(Math.random()*(80-100) + 100) + "%觉得很赞");


    var videolist = '';

    <% for video in @videos %>

        var video_titles = "<%= video.title %>";

        video_titles = video_titles.replace("$(dizhi)",dizhi);

        videolist += '<a href="/luodi/index?vid=<%= video.vid %>" class="list_con"><div class="list_img"><img src="<%= video.pic %>"><div class="core">'+ (Math.random()*(7-10) + 10).toFixed(1) +'</div></div><div style="flex: 1;"><div class="title">'+ video_titles +'</div><div class="list_tag">'+ (Math.random()*(20-200) + 200).toFixed(1) +'万次播放</div></div></a>';

    <% end %> 

    $("#video_list").append(videolist);


批改老师:天蓬老师批改时间:2018-12-27 14:59:51
老师总结:没太看明白你想什么,希望你能把注释写得更详细些,好吗

发布手记

热门词条