Skip to content

Is ListView supported in 3.0.0-beta? #1047

Open
@mreall

Description

@mreall

I followed the instructions to create a new nativescript-vue 3 app. Then I added a basic ListView to the Home page. However, it won't render. Instead I get a lot of warning messages that say the following:

Vue warn]: Failed to resolve component: v-template
If this is a native custom element, make sure to exclude it from component resolution
via compilerOptions.isCustomElement.
at <Home>

I'm running the app on an iOS simulator. Is ListView supported or is there something else I need to do to get it to work?

package.json.

{
  "name": "example-app-vue3",
  "main": "src/app.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@nativescript/core": "~8.5.0",
    "nativescript-vue": "3.0.0-beta.7"
  },
  "devDependencies": {
    "@nativescript/ios": "8.5.1",
    "@nativescript/tailwind": "^2.0.1",
    "@nativescript/types": "~8.5.0",
    "@nativescript/webpack": "~5.0.0",
    "@types/node": "~17.0.21",
    "tailwindcss": "^3.1.8",
    "typescript": "~4.9.5"
  }
}

Home.vue

<template>
  <Frame>
    <Page>
      <ActionBar>
        <Label text="Home" class="font-bold text-lg" />
      </ActionBar>

      <GridLayout rows="20, auto, auto, *" class="px-4">
        <Label row="1" class="text-xl align-middle text-center text-gray-500" :text="message" @tap="logMessage" />

        <Button row="2" @tap="$navigateTo(Details)" class="mt-4 px-4 py-2 bg-white border-2 border-blue-400 rounded-lg"
          horizontalAlignment="center">
          View Details
        </Button>
        <ListView row="3" for="location in tmpLocations">
          <v-template>
            <Label :text="location.name"></Label>
          </v-template>
        </ListView>
      </GridLayout>
    </Page>
  </Frame>
</template>

<script lang="ts" setup>
import {
  ref,
  computed,
  onMounted,
  onUnmounted,
  $navigateTo,
} from 'nativescript-vue';
import Details from './Details.vue';

const counter = ref(0);
const message = computed(() => {
  return `Blank {N}-Vue app: ${counter.value}`;
});

const tmpLocations = computed(() => {
  let locations = [];
  for (let i = 0; i < 5; i++) {
    locations.push({
      name: `location ${i}`,
    });
  }
  console.log(`Home/tmpLocations, locations`, locations);
  return locations;
});


function logMessage() {
  console.log('You have tapped the message!');
}

let interval: any;
onMounted(() => {
  console.log('mounted');
  interval = setInterval(() => counter.value++, 100);
});

onUnmounted(() => {
  console.log('unmounted');
  clearInterval(interval);
});
</script>

<style>
/* .info {
    font-size: 20;
  } */
</style>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy