-
The image cropping and uploading component vue-image-crop-upload in vue cannot be uploaded.
the time code I am using is as follows:
<template>
<div class="image-cropper">
<el-button @click="visible=true">< el-button>
<my-upload v-model="visible" :url=" http: upload.qiniu.com ...
-
What is the most elegant way to implement an array of ES6 objects based on a property?
A solution that conforms to the meaning of the question
function unique(arr) {
const res = new Map();
return arr.filter((a) => !res.has(a) && res.set(a, 1))
}
because map key is unique, you can change the an in res.has (a) to whate...
-
How does es6's Set customize the de-repetition rules? How can an array of objects be duplicated according to a column property?
for example, duplicates according to the name attribute in the an array element.
is this the simplest way?
function unique(arr) {
const res = new Map();
return arr.filter((a) => !res.has(a.name) && res.set(a.name, 1))
}
reference...
-
How does js elegantly concatenate the date of time 1 and the time of time 2?
my way is to use toLocaleDateString (), to get the string form of time 1 2018,). Gettime () 4 and 28, and then bring it into new date (2018-4-28
then string 2 also gets the time, of the date
then subtract the time of the date of string 2 from the ti...
-
What is the most elegant way for js to add another array to the end of the array?
is there a method like push, but instead of inserting an element into an array, add another array similar to java s addAll method
all I know so far is concat, but he returns the new array instead of making changes on the original array,
...
-
It doesn't matter how gracefully es6 judges that the values contained in two arrays are exactly the same.
this is what I do now. Is there a better way?
let flag = true
const listA = [1, 2, 3]
const listB = [2, 3, 4]
if (listA.length !== listB.length) {
flag = false
} else {
listA.forEach(item => {
if (listB.indexOf(it...
-
In the js template engine, where does all this data come from?
In the js template engine, where does the data come from and how the page does not have the variable isAdmin? you can refer to directly.
< script id= "content " type= "text html " >
{{if isAdmin}}
<h1>{{title}}< h1>
<ul>
...
-
Phpstorm I have set up ES6 and VUE, why is there such a warning?
ask the boss to give me some advice!
...
-
Get the getters,Cannot read property 'getters' of undefined of store
uses the login permission judgment in vue-element-admin, which is basically introduced and loaded according to it, but it still prompts you to report an error main.js .
import Vue from vue
import App from . App
import router from . router
i...
-
Am I right to write this about the use of the promise function?
as follows, I have two functions written in promis form
function one
verifyGA(type){
let that = this;
return new Promise((resolve,reject) => {
that.$post( user verifyGA ,{
gaCode:that.gaCode,
captchaType:...
-
Inheritance of the es6 class, Class constructor xxx cannot be invoked without 'new'
there is a class A , SubA inherits A, but the console reports an error Class constructor xxx cannot be invoked without new how to solve it?
A
class A{
constructor() {}
};
export default A
A
import A from xxx
class SubA extends A{
co...
-
Can v-for in Vue traverse Map?
if you can, please give me an example.
thanks for your time!
...
-
Can the code for making new arrays in the computed of this vue be simplified?
computed: {
poolList () {
const poolList = []
this.bettingObjectList.forEach(bettingObject => {
poolList.push(...bettingObject.poolList)
})
return poolList
},
}
think it s tedious, can it be simplified
...
-
Can webpack HRM hot updates print out the time it takes to update each change on the console?
can webpack HRM hot updates print out the time it takes to update each change on the console? wants to know how long it takes to update each change so that it can be optimized. And how long it took to start it for the first time. Excuse me, where can I ...
-
How to practice the unified management of axios interface?
at the beginning of the project, axios was introduced into main.js, and then axios is hung on the instance through Vue.prototype.$ajax = axios; , and the request is sent by calling this.$ajax in each file. now the project is getting bigger and bigger...
-
How to Filter array
the first two arrays are like this. The b array adds a field to the an array
a = [{
label: ,
organizeId: 1001
}, {
label: ,
organizeId: 1002
}, {
label: ,
organizeId: 1003
}, {
label: ,
...
-
Why is the result of import module from node_modules different from that of direct import dist source file?.
problem description
it is normal to import modules from node_modules, but the direct import dist file is undefined,
related codes
from node_modules, work well
import Layout from @xxx layout-auth dist layout
from source dist, resolve to ...
-
The result cannot be return in .then of the es6 function
export function postMethod(data) {
const baseURL = process.env.BASE_API
axios({
method: post ,
url: baseURL + img_upload ,
timeout: 50000,
data: data,
headers: {
loginToken : getLoginToken()
}
}).then(res =&g...
-
Filter is used in vue and indexOf is used to report errors.
whether I abbreviate it or write it step by step, it is an error. There is no corresponding array filtered out. Item.username is a string and can be printed out, not without value. Why the report was wrong. Please point out if there is anything wron...
-
Deconstructing assignment reporting error
the this.privacy in the component uses the data obtained from state by mapState. The following is written as follows: Unexpected token where did I write this wrong?
component
data () {
return {
item1: ,
item2: ,
item...