Vue.js

填坑前序(json坑)

别等时光非礼了梦想. 提交于 2021-02-19 11:48:54
之前空间开了一个坑,说要分享一下json学习的心得,嘛,最近一段时间忙着应聘,完了还要准备学javaweb框架和vue.js,没来得及填坑,那么明天开始填上上周说的json的学习的坑,首先,由于我目前用Java开发后台,所以这次我们学的是Java的json处理(虽然PHP比JAVA的容易emmmmmm,PHP天下第一!) 由于学校还没教json,我先给不清楚的朋友介绍下json(以下资料来自CSDN博客 https://blog.csdn.net/SiLaSiLa__/article/details/79479196 ) JSON的全称是”JavaScript Object Notation”,意思是JavaScript对象表示法,它是一种基于文本,独立于语言的轻量级数据交换格式。XML也是一种数据交换格式,为什么没有选择XML呢?因为XML虽然可以作为跨平台的数据交换格式,但是在JS(JavaScript的简写)中处理XML非常不方便,同时XML标记比数据多,增加了交换产生的流量,而JSON没有附加的任何标记,在JS中可作为对象处理,所以我们更倾向于选择JSON来交换数据。这篇文章主要从以下几个方面来说明JSON。 1,JSON的两种结构 2,认识JSON字符串 3,在JS中如何使用JSON 4,在.NET中如何使用JSON 5,总结 JSON的两种结构 JSON有两种表示结构

How to bind a class on click event of elements obtained through a loop?

删除回忆录丶 提交于 2021-02-19 08:05:07
问题 I go through an array of objects to display in my html some information boxes that are selectable. For it I bind a class in the event click, but as I obtain the elements through a v-for, when I select one it bind the class to all of them. How can I differentiate only the selected one? I have seen several examples with jquery but I would like to know if there is any other method. My template: <div class="list-services"> <div class='column-service' v-for='estimation in filteredEstimation' v

VueJS Typescript - DOM not updating with variable in Super Class

本秂侑毒 提交于 2021-02-19 07:39:46
问题 Essentially I have a BaseAuthController with on common login functions and variables, I then have a SignupController and a LoginController that inherit from the BaseAuthController. I have looked at the variable through breakpoints and the variables are all being set correctly and they exist. The issue is changing the variable in the super class is not then updating the DOM BaseAuthController.ts import { RouterStates } from './../../../routing/RouterStates'; import Vue from "vue"; export class

Vue component v-model with input handler

依然范特西╮ 提交于 2021-02-19 07:31:12
问题 I'm trying to make a wrapper component for an <input/> element in Vue.js. Component: <template> <div> <input v-bind="$attrs" :value="value" @input="input" /> ... </div> <template> Vue.component("my-input", { inheritAttrs: false, props: ['value'], methods: { input($event): void { this.$emit("input", $event.target.value) } } }) Usage: <my-input v-model="myModel" /> This seems to work just fine. The model gets updated via the input event handler by emitting the target element value. However, now

vue multiselect 1.1.4, select value by id

℡╲_俬逩灬. 提交于 2021-02-19 06:38:04
问题 i added multiselect component which looks like this View <multiselect :options="books" :selected="selectedBook" :show-labels="false" placeholder="Choose your book" label="name"> <span slot="noResult">No books were found</span> </multiselect> Script <script> export default { data() { return { books: [], selectedBook: null, } }, created() { this.getBooks(); this.getFav(); }, methods: { getBooks() { this.$http .get('/books/') .then( function(response) { this.books = response.json(); } ); },

Run Vue.js and Laravel on the same server (same port)

半世苍凉 提交于 2021-02-19 05:38:13
问题 I am developing a website using Laravel as backend and Vue.js 2 as frontend. Now everytime i want to run my website I have to use 2 command: php artisan serve This will run the laravel server on port 8000 npm run dev This will run the vue.js server on port 8080 Can I just run them on the same server (same port), with just one command only?? 回答1: If you use the Laravel app with Vue.js included in it, you don't need to run npm run dev . In your case, you seem to have a decoupled frontend and

How to make AudioWorklets work with vue-cli/webpack/babel? (getting illegal invocation error)

半腔热情 提交于 2021-02-19 05:18:46
问题 I'm trying to create a WebApp with vue-cli that uses AudioWorklets, but I'm getting a bunch of errors when trying to access any property of my AudioWorkletNode, like port or channelCount etc: TypeError: Illegal invocation at MyWorkletNode.invokeGetter After hours of googling and debugging I think it's somehow related to classes, AudioWorklet seems to only work with ES6 classes but one of vue-cli/babel/webpack does it's magic (which I don't understand where and what it does) and transpiles the

Passing data from PHP/HTML to .vue Component

喜欢而已 提交于 2021-02-19 05:18:06
问题 What I'm trying to do is seemingly simple, but I can't seem to figure it out. Basically, I have 2 files: A PHP file with the following: ... <user-panel v-if="user.id && loaded" v-bind:user="user" v-bind:name="theUserName"></user-panel> ... A .Vue component file with the following (that gets compiled into another file): <template> <span id="userPanel" class="d-flex align-items-center"> <a href="#" role="button" class="user-dropdown-toggle"> <div class="logged-in d-flex align-items-center">

VueJS scroll to section from different route

孤者浪人 提交于 2021-02-19 03:55:13
问题 I am trying to scroll to an anchor on a page using Vue and Vue Router (with history mode). When on the index page, the scroll behaviour works as expected by jumping to the section. However, when I am another page, it loads the index page at the top and not where the anchor is pointing to. I’m sure it’s a very simple thing but can’t get my head round it! Any help is appreciated! My router index: export default new Router({ scrollBehavior: function(to, from, savedPosition) { if (to.hash) {

Laravel Vue SPA vs MPA/SSR

和自甴很熟 提交于 2021-02-19 03:51:21
问题 Many laravel/vue tutorials use ajax calls to get the data. It seems that the SPA is completely isolated from Laravel. I.e. Laravel is just a data API and the vue app could also simply be hosted on a third party external server (e.g. AWS S3). Is this the recommended way, or should I rather use Laravel for Routing and have separate views that implement individual components and already included data instead of using a SPA? 回答1: For an SPA, I would recommend just going with the standard setup,