1. 引入jquery和vue.js

<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>

2. JS

<script type="text/javascript">
$(function(){
	vm = new Vue({
        el:'#lst',
        data:{
            mcs : []
        }
    });
	getmc();
});

function getmc(){
	$.get("getJsonData.action",
        function(msg){
	    vm.mcs = msg
    });
}
</script>

3.  HTML

<div id="lst" v-cloak>
        <div v-for="mc in mcs">
                <p>
                    <a :href="'abbbbb.action?id=' + mc.id ">{{mc.titles}}</a>
                </p>
            </div>
        </div><p>
    <input type="button" οnclick="getmc()" value="更新页面" />
</p>
Logo

前往低代码交流专区

更多推荐