Vue Multi Counter - Nativescript Typing CST Test
Loading…
Vue Multi Counter — Nativescript Code
Multiple independent counters in a single page.
<template>
<Page class="page">
<ActionBar title="Multi Counter" class="action-bar" />
<StackLayout class="container" horizontalAlignment="center" verticalAlignment="center">
<StackLayout v-for="(c, index) in counters" :key="index" class="counter-block">
<Label :text="`Counter ${index+1}: ${c}`" class="counter-text" />
<Button text="+" @tap="() => increment(index)" class="btn-primary" />
</StackLayout>
</StackLayout>
</Page>
</template>
<script>
import { ref } from 'vue';
export default {
setup() {
const counters = ref([0,0,0]);
const increment = (i) => counters.value[i]++;
return { counters, increment };
}
};
</script>
<style scoped>
.page { background-color: #fff; color: #000; }
.container { margin-top: 50px; text-align: center; }
.btn-primary { margin: 5px; }
.counter-text { font-size: 20px; margin-bottom: 10px; }
</style>Nativescript Language Guide
NativeScript is an open-source framework for building truly native mobile applications using JavaScript, TypeScript, Angular, or Vue. It allows developers to write cross-platform apps that access native APIs directly without using WebViews.
Primary Use Cases
- ▸Cross-platform native apps for iOS and Android
- ▸Enterprise apps requiring native performance
- ▸Apps needing access to full device APIs and native UI
- ▸Rapid prototyping of native mobile apps
- ▸Integration with Angular, Vue, or plain TypeScript/JavaScript front-end
Notable Features
- ▸Direct access to native UI components
- ▸Cross-platform with single codebase
- ▸Supports Angular, Vue, and plain TypeScript/JavaScript
- ▸Large ecosystem of plugins for device APIs
- ▸Open-source and actively maintained
Origin & Creator
Developed by Progress in 2015, NativeScript was created to bridge the gap between web development skills and native mobile development, providing a cross-platform solution without relying on WebViews.
Industrial Note
Perfect for enterprises and startups seeking cross-platform apps with fully native performance while leveraging existing JavaScript/TypeScript skills.