·练习常见操作:
·通过v-for创建组件
<!DOCTYPE html> <html lang=“en”> <head> <meta charset=“UTF-8”> <meta name=“viewport” content=“width=device-width, initial-scale=1.0”> <title>Document</title> </head> <body> <div id=“app”> <demo-item v-for=“item in items” :item-title=“item.title” :item-content=“item.content” :key=“item.title” :item=“item” ></demo-item> </div> <script src=“lib/vue.js”></script> <script> Vue.component(‘demoItem’, { props: [‘itemTitle’, ‘itemContent’, ‘item’], template: `{{ itemTitle }}
{{ itemContent }}