how use linq width vue
fan92rus opened this issue · comments
i can't understan how connect your linq to vue project.
Hi, I don't have any experience with Vue, you have a better chance of getting help if you ask this on Stackoverflow.
Make sure to better describe your use case and provide code samples.
Hi, try using this tool: https://github.com/ryanelian/instapack
ipack new vue
You should now be able to import LINQ from the Vue code (for example in MyLINQ.vue
)
<template>
<div>
<p>{{x}}</p>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import Component from 'vue-class-component';
import Enumerable from 'linq';
@Component({})
export default class MyLINQ extends Vue {
x: number = Enumerable.from([1, 2, 3]).sum();
}
</script>
As usual, then you'd want to register the component (in vue-project.ts
which is imported from index.ts
entry point). You know, the usual Vue stuff:
import Vue from 'vue';
import MyLINQ from './components/MyLINQ.vue';
Vue.component('my-linq', MyLINQ);
new Vue().$mount('#app');
When done, simply use the component in your app. Also the usual Vue stuff:
<div id="app">
<my-linq></my-linq>
</div>
then build: ipack
(production) or ipack -dw
(dev+watch mode) or ipack -h
(hot reload mode)
then reference the built script on your html:
<link rel="stylesheet" href="wwwroot/css/ipack.css" />
<script src="wwwroot/js/ipack.dll.js"></script>
<script src="wwwroot/js/ipack.js"></script>