Vue.js

Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html') Vue js?

≯℡__Kan透↙ 提交于 2021-01-28 05:58:19
问题 I want to include service worker in my vue js project and i did this before with my simple HTML projects in which it works really great but when i include the same file to my vue js code it keeps throwing the error The script has an unsupported MIME type ('text/html'). index.js?3609:11 Service wroker: error: SecurityError: Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html'). here is the code which i used for ragister my service worker if (navigator

How to properly pass data to sibling component using VueJS?

丶灬走出姿态 提交于 2021-01-28 05:53:45
问题 Let's say I have CountrySelect and CitySelect , where in CountrySelect are listed all countries and in CitySelect are only listed those cities of currently selected country... What would the proper way to pass newly selected country. As I have read in vuejs documentation: In Vue, the parent-child component relationship can be summarized as props down, events up. The parent passes data down to the child via props, and the child sends messages to the parent via events. Let’s see how they work

Error in v-on handler (Promise/async): “TypeError: Cannot read property 'data' of undefined” // undefined

谁说胖子不能爱 提交于 2021-01-28 05:25:34
问题 I am trying to push data from a v-text-field onto a json file. When i tried it on Postman it worked so I'm guessing the error is coming from the client side product.vue <v-container> <v-row> <v-col> <v-text-field label="440" v-model="onetext" ></v-text-field> <v-text-field label="Card Type" v-model="twotext" ></v-text-field> <v-text-field label="Card Type" v-model="threetext" ></v-text-field> <v-text-field label="Card Type" v-model="fourtext" ></v-text-field> <v-text-field label="Card Type" v

Vuetify data table with nested data and v-slot:item

别说谁变了你拦得住时间么 提交于 2021-01-28 03:50:52
问题 I would like to create a Vuetify table with nested data. The problem is that v-slot:item doesn't seem to work with nested data. This is my code: https://codepen.io/blakex/pen/XWKWjaE <v-data-table :headers="headers" :items="desserts"> <template v-slot:item.calories="{ item }"> <td>Slot works: {{ item.calories }}</td> </template> <template v-slot:item.nested.nestedCalories="{ item }"> <td>Nested slot works: {{ item.nested.nestedCalories }}</td> </template> </v-data-table> data () { return {

Nuxt: Fetching data only on server side

不羁岁月 提交于 2021-01-28 03:29:42
问题 I am using Github's API to fetch the list of my pinned repositories, and I put the call in the AsyncData method so that I have the list on the first render. But I just learnt that AsyncData is called once on ServerSide, then everytime the page is loaded on the client. That means that the client no longer has the token to make API calls, and anyways, I wouldn't let my Github token in the client. And when I switch page (from another page to the page with the list) the data is not there I just

Vuetify data table with nested data and v-slot:item

左心房为你撑大大i 提交于 2021-01-28 02:42:05
问题 I would like to create a Vuetify table with nested data. The problem is that v-slot:item doesn't seem to work with nested data. This is my code: https://codepen.io/blakex/pen/XWKWjaE <v-data-table :headers="headers" :items="desserts"> <template v-slot:item.calories="{ item }"> <td>Slot works: {{ item.calories }}</td> </template> <template v-slot:item.nested.nestedCalories="{ item }"> <td>Nested slot works: {{ item.nested.nestedCalories }}</td> </template> </v-data-table> data () { return {

Select one feature of multiple overlapping features (here polygons) on a Leaflet map

僤鯓⒐⒋嵵緔 提交于 2021-01-28 02:35:40
问题 I have a map with multiple polygons rendered on it which can overlap eachother. I use leafletPip.pointInLayer(point, layer) from https://github.com/mapbox/leaflet-pip for determining which polygons do overlap. This happens in the processClick function. In the Vue object I create the map and my GeoJSON layer with the polygons. What I now want is following feature: if you click on a point on the map and this point is contained in multiple polygons, you have something like a selection tool, e.g.

How can I prevent numeric inputs using VueJS

£可爱£侵袭症+ 提交于 2021-01-28 02:08:30
问题 I need to create a validation that prevent the user from inputting numeric inputs on a textbox. I found some solution using a native javascript but it is not working on my side. On my text box I have this trigger v-on:keyup="preventNumericInput($event)"> And on my Vue I created a function on my class preventNumericInput($event) { console.log($event.keyCode); //will display the keyCode value console.log($event.key); //will show the key value var keyCode = ($event.keyCode ? $event.keyCode :

Infinite loop when checking roles. VueJS

ぃ、小莉子 提交于 2021-01-28 01:33:32
问题 There is a navigation bar where elements are displayed depending on the user's role: <b-navbar-toggle right class="jh-navbar-toggler d-lg-none" href="javascript:void(0);" data-toggle="collapse" target="header-tabs" aria-expanded="false" aria-label="Toggle navigation"> <font-awesome-icon icon="bars"/> </b-navbar-toggle> <b-collapse is-nav id="header-tabs"> <b-navbar-nav class="ml-auto"> <b-nav-item-dropdown right id="pass-menu" v-if="hasAnyAuthority('ROLE_USER') && authenticated" :class="{

Vue.js proper random ordering of v-for loop

房东的猫 提交于 2021-01-27 21:54:10
问题 Have a list that i want to output in random order. I achieved this with computed property: <div id="app"> <ul> <li v-for="list in randomList" > {{ list.text }} </li> </ul> </div> <script> var vm = new Vue({ el:'#app', data:{ lists:[ {text:'js',value:'one'}, {text:'css',value:'two'}, {text:'html',value:'three'} ] }, computed: { randomList: function(){ return this.lists.sort(function(){return 0.5 - Math.random()}); } } }); </script> But if i have more than one list i that want to simplify this