vuejs2

Accessing and using Firestore subcollection data using VueJS (rookie question)

為{幸葍}努か 提交于 2021-01-29 11:07:26
问题 I am fairly new to VueJs and Firestore and I am having a couple of rookie teething problems that I can't quite answer using the documentation. I apologise in advance if this is answered elsewhere, I have been trawling for the last couple of days and couldn't see anything that was directly helpful. So my problem is two-fold: 1) How do I access subcollections in Firestore? - I read that this functionality is now available and I believe you can dive into these subcollections using db

how to get access to vuex inside other js files like plugins in nuxt

a 夏天 提交于 2021-01-29 10:44:04
问题 i have a problem. i wanna get access to one of my getters inside my vee-validate.js file. how can i do that? in my pages and components, (in <script>...</script> part, outside export default{...} ) i used this function: component.vue <script> let lang; function getLang({store}) { lang = store.state.lang } export default{ ... } but it is not working! i'm trying to access my custom lang file (for translation purpose) that is stored in lang state in my vuex, and use it in vee-validate.js file

v-runtime-template and vuex cause infinite update loop

≯℡__Kan透↙ 提交于 2021-01-29 08:31:41
问题 I came across an infinite loop that really confused me. I used v-runtime-template to load dynamic forms, everything works fine when I use static data, but switches to an infinite loop after getting data from vuex. I have written two examples with CodeSandbox, but note that clicking on Demo2 may cause the browser to die. The loading of data needs to be done through vuex. How to solve the problem of infinite loop, I look forward to your help. 回答1: I have solved this problem. defining a sub

How do I display one object of an array in Vue.JS

限于喜欢 提交于 2021-01-29 08:07:55
问题 Let's say I have this list of objects in Vue.JS data () { return{ examples: [ { exampleID: 5, exampleText: 'foo' }, { exampleID: 3, exampleText: 'bar' } ] } } Now let's say I want to display the object with the exampleID of 3 in an element i created before <Task v-for="example in examples" :key="example.exampleID" :example="example" /> I want to display everything, that is in the object (the ID and the text) Task component : <template> <div class="exercise"> <div class="exercise-id"> <h1>ID

get length value from vue observer

坚强是说给别人听的谎言 提交于 2021-01-29 07:01:23
问题 i've developing electron apps with vue-cli-plugin. when print an array it's return observer. what i do: console.log(this.listfile) output from developer tools [__ob__: Observer] 0: {__ob__: Observer} 1: {__ob__: Observer} 2: {__ob__: Observer} 3: {__ob__: Observer} 4: {__ob__: Observer} 5: {__ob__: Observer} 6: {__ob__: Observer} 7: {__ob__: Observer} 8: {__ob__: Observer} 9: {__ob__: Observer} 10: {__ob__: Observer} 11: {__ob__: Observer} 12: {__ob__: Observer} 13: {__ob__: Observer} 14: {_

Vue - Calling store getter after dispatch completes?

烂漫一生 提交于 2021-01-29 06:57:47
问题 I'm using Laravel 5.7 + Vue2 + Vuex I am having some difficulty getting Vue to return a store value after my dispatch call completes. My application flow looks like this: I click a submit button which calls validate() on the component. Validate() dispatches to my "addLease" action which calls the store api in a Laravel controller. Laravel validates the data and returns a response with errors, or a success message. A commit is then performed to update the leaseStore state with the appropriate

Vue.js: Cannot retrieve data from cloud firestore

非 Y 不嫁゛ 提交于 2021-01-29 06:32:41
问题 I created the database on cloud firestore, and the collection name is products. Now I want to retrieve all the resources in my collection. I have already created 12 products in my database. But in my vue-devtool, I cannot see any array. How can I retrieve the data from cloud firestore? Here is my vue.js code. <template> <h3 class="d-inline-block">Products list</h3> <div class="product-test"> <div class="form-group"> <input type="text" placeholder="Product name" v-model="product.name" class=

Vue.js: Cannot retrieve data from cloud firestore

吃可爱长大的小学妹 提交于 2021-01-29 06:21:38
问题 I created the database on cloud firestore, and the collection name is products. Now I want to retrieve all the resources in my collection. I have already created 12 products in my database. But in my vue-devtool, I cannot see any array. How can I retrieve the data from cloud firestore? Here is my vue.js code. <template> <h3 class="d-inline-block">Products list</h3> <div class="product-test"> <div class="form-group"> <input type="text" placeholder="Product name" v-model="product.name" class=

passing data to route's component beforeEnter

最后都变了- 提交于 2021-01-29 05:44:39
问题 I have the following VueRouter route { path: '/playlists/:id', name: 'videos', component: Video, props: { videos: [] }, beforeEnter (to, from, next) { Vue.axios.get('/playlistitems?playlistId='.concat(to.params.id)) .then((response) => { to.params.videos = response.data next((vm) => { console.log(vm) vm.videos = response.data }) }) .catch((err) => console.log('error', err)) } } When the route is entered into everything executes as expected but I'm not sure how to pass the response.data to the

Can not send file to the .net core API from Axios (vue-nuxt)

社会主义新天地 提交于 2021-01-29 05:44:34
问题 I get back 500 errors if i try to send a file from Vue to my API endpoint in .net Core I followed tutorials who do this, but they do not seem to work for this setup. .net core API: [Route("api/[controller]")] [ApiController] public class FileUploadController : ControllerBase { [HttpPost("[Action]")] public string sendFiles([FromBody]FileUploadAPI file) { return "Yes!"; } public class FileUploadAPI { public IFormFile File { get; set; } } } Vue: this.$axios.post( 'https://localhost:44352/api