fonsleenaars / tqdb

Python parser for the Titan Quest Anniversary Edition, Ragnarok, Atlantis, Eternal Ember DLC database.
https://tq-db.net
MIT License
50 stars 15 forks source link

Question about JS #87

Closed chefranov closed 2 years ago

chefranov commented 4 years ago

Hi @fonsleenaars . How do you show data of item from your json? I mean your algorithm. Could you share react component/code with me?

I use Vue.js for display data and I think on the correct algorithm. Now I do it in layout, like that:

<div v-if="propName == 'itemSkillName'" class="item-skills2" :key="propIndex">
                <div v-for="(v, n, i) in propValue" class="item-skill" :key="i">
                  <span v-if="n == 'trigger'">{{ v }}</span>
                  <span class="item-skillname" v-if="n == 'tag'">{{ skills[v].name }}</span>
                  <span v-if="n == 'level'">Уровень: {{ v }}</span>
                  <span class="item-skilldescr" v-if="n == 'tag'">{{ skills[v].description }}</span>
                  <span class="item-skillprops" v-if="n == 'tag'">
                    <span v-for="(skillValue, skillName, skillIndex) in skills[v].properties[propValue.level -1]" :key="skillIndex">
                      <span v-if="typeof skillValue != 'object' && skillName != 'skillActiveManaCost'">{{ skillValue }}</span>
                      <span v-if="typeof skillValue == 'object'">
                        <span v-for="(skillItemValue, skillItemName, skillItemIndex) in skillValue" :key="skillItemIndex">
                          <span v-if="typeof skillItemValue !== 'object'">{{skillItemValue}}</span>
                          <span v-if="typeof skillItemValue == 'object'">
                            <span v-for="(chanceValue, chanceName, chanceIndex) in skillItemValue" :key="chanceIndex">{{chanceValue}}</span>
                          </span>
                        </span>
                      </span>
                    </span>
                  </span>
                </div>
              </div>

I understand that incorrect way and it need to do in a function and etc

fonsleenaars commented 2 years ago

@chefranov I'm guessing you solved this right? 😛 Feel free to close it

chefranov commented 2 years ago

Yes. You can close it