backbone.js set model internal attributes hash directly

前端 未结 2 1998
抹茶落季
抹茶落季 2021-02-03 11:01

Using Backbone.js I know it\'s highly recommended to set a model\'s property using the set method, and NOT by directly modifying the attributes internal hash.

However, a

2条回答
  •  感情败类
    2021-02-03 11:13

    In the annotated source code mentioned by Brian Genisio you can read the following lines: "Handle both "key", value and {key: value} -style arguments.". So you can just use model.set(myProperty,"bar",options). Perhaps they've added this feature after the post of Brian Genisio.. i dunno.

提交回复
热议问题