3

In my App.vue

<template>
  <Page class="page">       
        <ActionBar title="my-app" class="top-nav" />
        <ListView v-show="showHome" for="(post, index) in posts" @itemTap="onItemTap" row="1">
            <v-template>
              <FlexboxLayout flexDirection="row" class="post-list" justifyContent="space-between">
                <FlexboxLayout flexDirection="column" width="15%" justifyContent="space-between" alignItems="center">
                  <Image src="~/images/up.png" @tap="onButtonTap('up', index)" class="up-down" />
                  <Label :text="post.score" class="post-count" />
                  <Image src="~/images/down.png" @tap="onButtonTap('down', index)" class="up-down" />
              </FlexboxLayout>
            </v-template>
        </ListView>
    </Page>
</template>

It works very well on Nativescript Playground, <Image /> did show up with the src

But when I debug on machine with an iOS simulator, it's not working..., the <Image /> parts are just a blank...

The project skeleton is shown as below

/app
|_ app.js
|_ app.css
|_ package.json
|_ /components
|   |_App.vue
|
|_ /images
    |_up.png

Anyone know what's going on? Thank you.

vanngoh
  • 626
  • 5
  • 15
  • Are you using the latest vue-cli template? That example worked here... – Tiago A. Oct 04 '18 at 09:16
  • Hi @TiagoA., thank you for replying! I'm not sure how to check the version of vue-cli template as you mentioned, but it's v2.9.6 for my vue-cli, are they the same? – vanngoh Oct 06 '18 at 06:05
  • Your comment in Jen Looper's answer tells me you are using the old project template. Follow the guide here to update to the new one: https://nativescript-vue.org/en/docs/getting-started/upgrade-guide/ – Tiago A. Oct 06 '18 at 14:32

1 Answers1

1

in a NativeScript-Vue app, the expected folder structure using our vue-cli template is to put your images in an assets folder. Can you give that a try? So put the .png files in app/assets/images.

Jen Looper
  • 428
  • 3
  • 4
  • Thank you so much for your help @Jen !! I've tried but still not working...And I also tried `rm -rf platform` before `npm run watch:ios` but still not working. Any idea? – vanngoh Sep 29 '18 at 02:26
  • You are using the old template. Follow this guide to upgrade: https://nativescript-vue.org/en/docs/getting-started/upgrade-guide/ – Tiago A. Oct 06 '18 at 14:33