会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133430个问题
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 77楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 78楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 79楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 80楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 81楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 82楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 83楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 85楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 86楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 87楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 88楼

<!DOCTYPE html>

<html lang="en">


<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>小黑记事本</title>

    <style>


    </style>

</head>


<body>

    <header></header>

    <section id="content">

        <input type="text" autofocus="autofocus" placeholder='输入你要记录的事情' v-model='inputvalue' @keyup.enter='add' />

        <ul>

            <li v-for='(item,index) in list'>{{item}}<button @click='decline(index)'>&nbspx</button></li>

        </ul>

        <button id="clear" @click='clearall'>删除所有记事</button>

    </section>

    <footer></footer>

    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

    <script>

        var maintext = new Vue({

            el: '#content',

            data: {

                maintext: '666',

                list: ['吃饭''睡觉''写代码'],

                inputvalue: ''

            },

            methods: {

                add: function() {

                    this.list.push(this.inputvalue)

                },

                decline: function(index) {

                    var ul = document.getElementsByTagName('ul')

                    var li = document.getElementsByTagName('li')

                        //console.log(li + ul);

                    li.ul.removeChild(li)

                        // this.list.splice(index, 1)

                },

                clearall: function() {

                    this.list = null

                    document.querySelector('#clear').innerHTML = ''

                }

            }

        })

    </script>

</body>


</html>


WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 89楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 90楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637