zoukankan      html  css  js  c++  java
  • vue局部组件

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="./vuev2.5.21.js"></script>
    </head>
    <body>
        <div id="app">
                <input type="text" v-model="inputValue">
                <button @click="BtnClick">提交</button>
                <ul>
                    <!-- <li v-for="item in list">{{item}}</li> -->
                    <todo-item v-bind:content="item"  v-for="item in list"></todo-item>
    
                </ul>
        </div>
        <script>
            // Vue.component("TodoItem",{
            //     props:["content"],
            //     template:"<li>{{content}}</li>"
            // });
            var todoItem={
                props:["content"],
                template:"<li>{{content}}</li>"
            };
            var app= new Vue({
                el:"#app",
                components:{
                    TodoItem:todoItem
                },
                data:{
                    inputValue:"",
                    list:[],
                },
                methods:{
                    BtnClick:function(){
                    //   console.log(this.list);
                    this.list.push(this.inputValue);
                    this.inputValue=""; 
                    }
                }
            })
        </script>
        
    </body>
    </html>
  • 相关阅读:
    菜根谭#317
    菜根谭#316
    菜根谭#315
    菜根谭#314
    菜根谭#313
    菜根谭#312
    菜根谭#311
    菜根谭#310
    菜根谭#309
    Matlab xpC启动盘
  • 原文地址:https://www.cnblogs.com/tuziling/p/10197653.html
Copyright © 2011-2022 走看看