web vuexuexi 已经发布

此版本更新内容包括:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./Vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <style>
      #app{
       
      }
      
    </style>
</head>
<body>
    <div id="app">
        <tab></tab>
        <list></list>
        <page></page>
    </div>
    <script>
     Vue.component('tab',{
         data(){
             return{
                 tabs:['全部','精华','问答','招聘','分享']
             }
         },
         template:
         `
         <ul v-class="tab">
            <li v-for="(item,index) in tabs":key="index">{{item}}</li>
            </ul>`
            
     })
     Vue.component('list',{
         data(){
             return{
                 lists:[]
             }
         },
         template:`
         <ul class="list">
          <li v-for="(list,index) in lists" :key="index">{{list.title}}</li>
            </ul>
         `,
         mounted(){
             axios.get('https://cnodejs.org/api/v1/topics').then(res=>{
                 console.log(res)
                 this.lists= this.lists.concat(res.data.data)
             }).catch(err=>{
                 console.log(err);
             })
         }
     })
    
  Vue.component('page', {
      template: `
      <ul class="page">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        </ul>
      `
  })
    new Vue({
        el: '#app',
        data: {

        }
    })

    </script>
</body>
</html>

详情查看:https://gitee.com/nicia/web/releases/vuexuexi

返回顶部
顶部