会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133430个问题
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vuex状态管理 46楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 47楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 48楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 49楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue路由 50楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 54楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 55楼

image.png






老师,在代码没问题的前提下,视频中7:12那里我点开是这种状态的

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<script>
    $.ajax({
        type:'get',
        url:'http://localhost:3000/list',
        beforeSend:function(request){
            request.setRequestHeader("Authorization",'iwen');
        },
        success:function (data) {
            console.log(data);
        }
    })
</script>
</body>
</html>
var express=require("express");
var app=express();

app.all("/list",function (req,res,next) {
        //跨域处理
        res.header("Access-Control-Allow-Origin","*");
        res.header("Access-Control-Allow-Headers","Access-Control-Request-Headers:Origin,X-Requested-With,content-Type,Accept,Authorization");
        res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
        res.header("X-Powered-By",'3.2.1');
        res.header("Access-Control-Allow-Credentials",true);
        res.header("Content-Type","application/json;charset=utf-8");
        next();
})

app.get("/list",function (req,res) {
        if (req.headers.authorization == 'iwen' ){
          res.send({
            msg:"hello"
        })
        }else{
          res.send({
            msg:'登录超时'
          })
        }
})
app.listen(3000,function () {
        console.log(3000);
})


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

<!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基础知识 58楼
WEB前端全系列/第十九阶段:Vue2知识体系(旧)/Vue基础知识 60楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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