Vue.js

Laravel Auth Problem for Web and Api Routes

微笑、不失礼 提交于 2021-01-28 09:11:40
问题 Unfortunately, I can't find a solution for a user case, which must actually occur frequently. To describe it best, I put here the structure of my routes (web and api) of my laravelapp: routes/web.php get(start|products|product/{id}|contact|inprint|login|register) get(checkout|checkout/(any))->middleware( auth ) // Checkout is a VUE App routes/api.php // only the Vue App use the api get(user|user_orders|user_address) ->middleware( auth ) post (purchase_order) -> middleware(auth) As you can

Uncaught ReferenceError: jQuery is not defined VueJS Parcel

偶尔善良 提交于 2021-01-28 08:32:22
问题 I have this: import jQuery from 'jquery' import HSCore from './components/assets/js/hs.core.js' Yet I still get this: Uncaught ReferenceError: jQuery is not defined at Object.parcelRequire.client/components/assets/js/hs.core.js (hs.core.js:177) Why 😑 import jQuery from 'jquery' does actually import jQuery (via console.log(jQuery) ), but my other JS file is having problems accessing it(?). This is in a Vue file using Parcel loader. hs.core.js file: (function ($) { ... })(jQuery); //<-- line

this.$store is undefined following example application structure

微笑、不失礼 提交于 2021-01-28 08:23:01
问题 I'm trying to use Vuex as shown in the application structure documentation. However, $store isn't showing in Vue dev tools and returning undefined in my code. I've used the shopping cart example as a reference. import Vue from 'vue/dist/vue'; import store from './store'; import router from './router'; const app = new Vue({ el: '#app', store, router, computed: { loading() { return this.$store.state.application.loading.active; } } }); In store/index.js (following the example layout) I have:

vuebootstrap b-collapse: when sidebar collapse, change margin-left content div

…衆ロ難τιáo~ 提交于 2021-01-28 07:43:29
问题 I have a problem with Vue Bootstrap, b-collapse (navbar, sidebar, content) https://jsfiddle.net/Lvkjn7he/1/ When click on navbar-toggler-icon (burger icon) (v-b-toggle="'sidebar-fifi-toggle'") into div b-navbar, the div sidebar collapase (), but the content div remains in its position. <style> #app { width: 500px; } .content { margin-left: 185px; top: 50px; } .sidebar { position: fixed; top: 51px; bottom: 0; left: 0; width: 190px; z-index: 1000; padding: 5px; overflow-x: hidden; overflow-y:

Best way to handle API calls from frontend

て烟熏妆下的殇ゞ 提交于 2021-01-28 06:52:58
问题 Okay, so atm i have a frontend application built with Nuxt JS using Axios to do requests to my REST API(separate). If a user does a search on the website the API URL is visible in XMLHttprequests so everyone could use the API if they want to. What is the best way of making it so that only users that search through my website gets access to the API and people that just directly to the URL gets denied. I suppose using some sort of token system, but what is the best way to do it? JWT? (Users

Vuejs computed properties that depend on other, asynchronous, computed properties

喜夏-厌秋 提交于 2021-01-28 06:50:21
问题 In my Vuejs app I need to pass two computed properties to a component called avatar : an image surce and a string. The problem is that not all items have a picture, and when they don't, vuejs throws an error because it cannot read property apples of undefined (because album_id is undefined). The error is being thrown from that very long-winded src property in the avatar component, below: <template> <div class="apples"> <div id="mast" class="f3 b bb b--black-10"> <h2 class="ttc">Apple's List<

How to pass a CSRF token safely to a separate VueJS frontend?

纵然是瞬间 提交于 2021-01-28 06:29:34
问题 Laravel(backend) and VueJS(frontend created with Vue CLI) are separated, hence have different domains and repositories. I am wondering what is the best way to pass a CSRF token from Laravel to VueJS safely . I've found some old questions here and on Laracasts but they are either irrelevant, outdated or have no answer. Here are a few: Pass csrf token from Laravel to Vue Creating a sign up token for Laravel app from separate frontend app (Laracasts forum) CSRF in separate angular app I am aware

Vue list animation with Greensock JS hooks: wait for leave to finish before enter

会有一股神秘感。 提交于 2021-01-28 06:24:50
问题 Is there a way to get Vue to wait for elements to leave a list before new ones enter? At the moment, the animation for new elements entering the list plays at the same time as the animation for elements leaving the list: var SPEED = 3; var app = new Vue({ el: '.container', data: { nodes: [ {id: 0, value: 5, name: "Alan"}, {id: 1, value: 15, name: "Bob"}, {id: 2, value: 25, name: "Charles"} ] }, methods: { enter(el, done) { var bar = $(el).children(".bar"); TweenMax.fromTo(bar, SPEED, {width:

Pass object as prop when pushing route

南笙酒味 提交于 2021-01-28 06:16:37
问题 This function is in a component outside router view. goToMarkets(){ this.$router.push({path: '/markets', params: {stock: this.model}}) } But the prop is undefined in the "Markets" component Router: const routes = [ { path: '/markets', name: 'Markets', component: Markets, props: true },] Markets component: props: { stock: Object }, The prop is undefined in the Markets component even though it's not before it is passed (in the first function). The whole code: https://github.com/mismaah-abdulla

is vuejs2.x composition api fully compatibile with typescript?

一世执手 提交于 2021-01-28 06:15:01
问题 Recently i migrated our vue.js2.x project to typescript, and based on evan-you's comment in this issue: https://github.com/vuejs/rfcs/pull/17#issuecomment-494242121 The Class API proposal is being dropped. so i'm using regular option based version of vue.js which it faced me with alot of type problems. I want to know is vuejs2.x composition api fully compatibile with typescript? and should i use it to solve all the problem? what is the best practice to do here in this situation? 回答1: I'm