data-bind 绑定

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u010282984/article/details/76473972
<div class="people_main_box" id="vMySkilfulTopic">
    <!--people_note-->    <div class="people_note">        <font><i class="fa fa-database"></i>金币:<span data-bind="text:MyReward">1985</span></font>        <font><i class="fa fa-thumbs-up"></i>赞同:<span data-bind="text:AgreeWithMe">9</span></font>    </div>
    <!--people_theme-->    <div class="people_theme">        <div class="people_theme_title">擅长主题</div>        <div class="item_follow_content public_clear" data-bind="foreach:TopicModelItem">            <font data-bind="text:Title">工作优化</font>                    </div>    </div>
</div>
<script type="text/javascript">    $(document).ready(function () {                function MySkilfulTopic() {            //用户ID            var UserEmployeeNo = getQueryCNString("EmployeeNo");            //擅长的主题            var UserSkilfulTopic = _spUserList[UserEmployeeNo].SkilfulTopicUser;            //获取我的赞同            var AgreeWithMe = _spUserList[UserEmployeeNo].AgreeMeCount;            //获取我的金币
            var MyReward = _spUserList[UserEmployeeNo].Reward;
//获取主题ID            var UserSpl = UserSkilfulTopic.split(";");
            var TopicArray = [];
            for (var i = 0; i < UserSpl.length; i++) {                var UserSplTrim = UserSpl[i].trim();                if (UserSplTrim != "") {                    var UserTrimJudge = _spTopicList[UserSplTrim];                    if (UserTrimJudge != null) {                        TopicArray.push(UserTrimJudge);                    }
                }
            }
var TopicModel = function () {                this.TopicModelItem = ko.observableArray(TopicArray);                this.AgreeWithMe = AgreeWithMe;                this.MyReward = MyReward;            }            ko.applyBindings(new TopicModel(), document.getElementById("vMySkilfulTopic"));

        }        MySkilfulTopic();    });
</script>
展开阅读全文

没有更多推荐了,返回首页