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

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

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