南港不秋 2021-08-30 21:22 采纳率: 100%
浏览 36
已结题

为什么会报错我不是绑定了吗

<head>
    <meta charset="utf-8">
    <title></title>
    <script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        * {
            margin: 0 auto;
            padding: 0;
        }

        .book {}
    </style>

</head>
<body>
    <div id="app">
        <div class="da">
            <div class="book">
                <div>****
                    <label for="id">
                        编号:
                        <input type="text" id="id" v-model='id' />
                    </label>
                    <label for="name">
                        名称:
                    </label>
                    <input type="text" id="name" v-model='name' />
                    <button @click="handle">提交</button>
                </div>
            </div>
        </div>
        <thead>
            <table border="1" width="500" height="200">
                <th>编号</th>
                <th>名称</th>
                <th>时间</th>
                <th>操作</th>
                </tr>
        </thead>
        <tr :key='item.id' v-for='item in bosl'>
            <td>{{item.id}}</td>
            <td>{{item.name}}</td>
            <td>{{item.date}}</td>
            <td>
                <a href="" @click.prevent>修改</a> <!-- prevent阻止默认跳转 -->
                <span>|</span>
                <a href="" @click.prevent>删除</a>
            </td>
        </tr>

        </table>


    </div>
    </div>
</body>
<script type="text/javascript">
    var mv = new Vue({
        el: '#app',
        data: {
            bosl: [{
                    id: 1,
                    name: '王者',
                    date: ''
                },
                {
                    id: 2,
                    name: '穿越',
                    date: ''
                },
                {
                    id: 3,
                    name: '飞车',
                    date: ''
                },
                {
                    id: 4,
                    name: 'HTML',
                    date: ''
                },

            ]
        },
        methods: {
            handle: function() {
                var book = {};
                book.id = this.id;
                book.name = this.name;
                book.date = "";
                this.bosl = plus(book);
                //清空表单
                this.id = '';
                this.name = '';
            }
        }
    });
</script>
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/596155923036114.png 'he.png')

  • 写回答

3条回答 默认 最新

  • 南柯ღk 2021-08-31 09:07
    关注

    是滴,你前面问的我发了一下代码,你可以看看。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 11月14日
  • 已采纳回答 11月6日
  • 创建了问题 8月30日

悬赏问题

  • ¥15 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了