V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ghostgril
V2EX  ›  问与答

vue 中的 props 如何正确的传递呢

  •  
  •   ghostgril · Jan 15, 2018 · 1298 views
    This topic created in 3024 days ago, the information mentioned may be changed or developed.
    props 中传递的是对象或是数组,根据 JavaScript 的特性,传递过来的是引用类型,所以我在子组件中也是能够修改父组件的数据的。
    为了避免干扰父组件数据,难道每次都将 props 数据转换成深拷贝的局部变量或计算属性吗?
    如何优雅的方式解决这种双向数据?
    为什么 props 传递过来的数据不使用深拷贝?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1486 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:56 · PVG 00:56 · LAX 09:56 · JFK 12:56
    ♥ Do have faith in what you're doing.