1. <small id='n2v2k'></small><noframes id='n2v2k'>

    1. <tfoot id='n2v2k'></tfoot>

      <legend id='n2v2k'><style id='n2v2k'><dir id='n2v2k'><q id='n2v2k'></q></dir></style></legend>
      • <bdo id='n2v2k'></bdo><ul id='n2v2k'></ul>
    2. <i id='n2v2k'><tr id='n2v2k'><dt id='n2v2k'><q id='n2v2k'><span id='n2v2k'><b id='n2v2k'><form id='n2v2k'><ins id='n2v2k'></ins><ul id='n2v2k'></ul><sub id='n2v2k'></sub></form><legend id='n2v2k'></legend><bdo id='n2v2k'><pre id='n2v2k'><center id='n2v2k'></center></pre></bdo></b><th id='n2v2k'></th></span></q></dt></tr></i><div id='n2v2k'><tfoot id='n2v2k'></tfoot><dl id='n2v2k'><fieldset id='n2v2k'></fieldset></dl></div>

      获取主干模型实例的模型/类名称

      时间:2024-04-19
      <legend id='UB2Na'><style id='UB2Na'><dir id='UB2Na'><q id='UB2Na'></q></dir></style></legend>

      <small id='UB2Na'></small><noframes id='UB2Na'>

      <tfoot id='UB2Na'></tfoot>

          <i id='UB2Na'><tr id='UB2Na'><dt id='UB2Na'><q id='UB2Na'><span id='UB2Na'><b id='UB2Na'><form id='UB2Na'><ins id='UB2Na'></ins><ul id='UB2Na'></ul><sub id='UB2Na'></sub></form><legend id='UB2Na'></legend><bdo id='UB2Na'><pre id='UB2Na'><center id='UB2Na'></center></pre></bdo></b><th id='UB2Na'></th></span></q></dt></tr></i><div id='UB2Na'><tfoot id='UB2Na'></tfoot><dl id='UB2Na'><fieldset id='UB2Na'></fieldset></dl></div>
            <tbody id='UB2Na'></tbody>
              <bdo id='UB2Na'></bdo><ul id='UB2Na'></ul>
              • 本文介绍了获取主干模型实例的模型/类名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                给定一个Backbone模型的实例,我怎么知道这个实例的类"(可以这么说)?

                Given an instance of Backbone model, how can I know the "class" (so to speak) of this instance ?

                例如:

                class Car extends Backbone.Model
                
                mycar = new Car()
                

                而我需要的是:

                mycar.modelName # => 'Car'
                

                推荐答案

                我认为总体上是有问题的.我打算建议这里提到的一些选项( 如何在 JavaScript 中获取对象类型的名称? ) 但我遇到了第一个选项的问题.您总是可以扩展您的所有模型,使其具有一个返回模型名称"的函数,但我可以理解为什么您会觉得这不太令人满意.

                It's problematic in general, I think. I was going to suggest some of the options mentioned here ( How do I get the name of an object's type in JavaScript? ) but I was having issues with the first option. You could always extend all your models to have a function that returned a "name" for the model, but I can understand why you might find that less than satisfactory.

                这篇关于获取主干模型实例的模型/类名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用复选框、AJAX、jQuery 更改属性 下一篇:在 CoffeeScript 中,是否有一种“官方"方法可以在运行时而不是在编译时插入字符串?

                相关文章

                <i id='NGOLD'><tr id='NGOLD'><dt id='NGOLD'><q id='NGOLD'><span id='NGOLD'><b id='NGOLD'><form id='NGOLD'><ins id='NGOLD'></ins><ul id='NGOLD'></ul><sub id='NGOLD'></sub></form><legend id='NGOLD'></legend><bdo id='NGOLD'><pre id='NGOLD'><center id='NGOLD'></center></pre></bdo></b><th id='NGOLD'></th></span></q></dt></tr></i><div id='NGOLD'><tfoot id='NGOLD'></tfoot><dl id='NGOLD'><fieldset id='NGOLD'></fieldset></dl></div>
              • <legend id='NGOLD'><style id='NGOLD'><dir id='NGOLD'><q id='NGOLD'></q></dir></style></legend>
                  <bdo id='NGOLD'></bdo><ul id='NGOLD'></ul>
                1. <small id='NGOLD'></small><noframes id='NGOLD'>

                  1. <tfoot id='NGOLD'></tfoot>