php数据添加成功后跳转固定连接,为表单添加完数据跳转后一直报错

TypeError: Cannot read property 'movie' of undefined

at C:\imooc\app.js:82:19

at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)

at next (C:\imooc\node_modules\express\lib\router\route.js:137:13)

at Route.dispatch (C:\imooc\node_modules\express\lib\router\route.js:112:3)

at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)

at C:\imooc\node_modules\express\lib\router\index.js:281:22

at Function.process_params (C:\imooc\node_modules\express\lib\router\index.js:335:12)

at next (C:\imooc\node_modules\express\lib\router\index.js:275:10)

at serveStatic (C:\imooc\node_modules\serve-static\index.js:75:16)

at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)

at trim_prefix (C:\imooc\node_modules\express\lib\router\index.js:317:13)

at C:\imooc\node_modules\express\lib\router\index.js:284:7

at Function.process_params (C:\imooc\node_modules\express\lib\router\index.js:335:12)

at next (C:\imooc\node_modules\express\lib\router\index.js:275:10)

at jsonParser (C:\imooc\node_modules\body-parser\lib\types\json.js:94:7)

at Layer.handle [as handle_request] (C:\imooc\node_modules\express\lib\router\layer.js:95:5)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这个问题的答案取决于你的具体需求和业务场景。一般情况下,我们可以通过以下两种方式来实现添加数据后的显示: 1. 刷新页面:当添加数据后需要重新读取整个页面数据时,可以通过刷新页面实现。这可以通过在添加数据后使用 `window.location.reload()` 方法来实现。这种方式相对简单,但用户体验不是很好。 2. 跳转页面:当添加数据后需要在新的页面中显示新增后的数据时,可以通过跳转页面实现。这可以通过使用 Vue Router 来实现。具体的实现方式是,在添加数据后通过编程式导航(`router.push()` 方法)跳转到新的页面,并携带新增后的数据作为路由参数,然后在新的页面中通过 `$route.params` 获取路由参数,并显示数据。这种方式相对复杂,但用户体验更好。 无论采用哪种方式,你都需要在添加数据后更新数据源,以便在刷新页面或跳转页面后能够正确显示新的数据。在 Vue 中,你可以使用 `this.$set()` 方法或 `Vue.set()` 方法来更新数据源。例如: ```javascript this.tableData.push(newData) // 添加数据 this.$set(this.tableData, this.tableData.length - 1, newData) // 更新数据源 ``` 其中,`this.$set()` 方法或 `Vue.set()` 方法的第一个参数是要更新的数据源,第二个参数是要更新的数据的索引或属性名,第三个参数是要更新的新值。这样就可以正确更新数据源了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值