Vue.js学习及总结——循环展示

html

 <table id="show">
        <template v-for="item in items">
            <tr>
            <td>{{ item.msg }}</td>
            <td>{{ item.kk }}</td>
            <td>{{ item.ll }}</td>
            </tr>
        </template>
 </table>

 js

var ex1 = new Vue({
    el: '#show',
    data: {
        parentMessage: 'Parent',
        items: [
            {msg: '11111',kk: '11111111',ll:'1111111111111'},
            {msg: '22222',kk: '222222222222',ll:'222222222222222'},
            {msg: '3333333333333',kk: '33333333333',ll:'3333333333333'},
            {msg: '4444444444',kk: '4444444444444',ll:'44444444444'},
            {msg: '5555555555555',kk: '55555555555555',ll:'555555555555555'},
        ]
    }
});

效果


 

猜你喜欢

转载自dingliang-321.iteye.com/blog/2265786