Monaca Onsen UI Discord Chat Github Repo

Cannot display value when using v-for



  • I have this array of objects but it seems I cannot display the value using the v-for on div. . Below is my code and the image for the value of the object.

    <div class="center" v-for="note in notes">
        <span>{{ note['doc']._attachment['file'].digest }} File here</span>
    </div>
    

    0_1501829456942_object.PNG


  • Onsen UI

    @jayGorio Are those notes obtained asynchronously? If yes, make sure you are not breaking Vue’s reactivity system when writing the objects.
    Also, wrap you scrollable content in <v-ons-page> with <div class="content">...</div>. Have a look at the DOM and see if the structure makes sense.



  • No they are obtained using promises.

    <template>
    <v-ons-page>
    	<div class="content">
    		<div class="center" v-for="note in notes">
    			appear here
    			<span>{{ note['doc']._attachment['file'].digest }} File here</span>
    		</div>
    	
    	</div>
    
    	<v-ons-fab
    		tappable
    		position="bottom right"
    		:style="{ backgroundColor: $ons.platform.isIOS() }"
    		:visible="fabVisible"
    		@click="dialogVisible = true"
    	>
    		<v-ons-icon icon="md-plus"></v-ons-icon>
    	</v-ons-fab>
    
    
    </v-ons-page>
    </template>


  • @Fran-Diox oops sorry the attachment has no s should be _attachments it’s working now thanks. It worked when I wrapped with div class=“content” .