vue 中scope和{scope}的区别

vue 中scope和{scope}的区别

为什么使用了{scope} template里面使用scope.$index就报错?

image.png

阅读 2.2k
1 个回答

这个应该和解构的含义差不多

const { a, b, c } = { a: 'a', b: 'b', 'c' }
const scope = { $index: 1 }
const { $index } = scope;
// if you use {scope} in template
const { $index } = { scope }

所以你什么都拿不到,还报错了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题