Vue.js

reference assets with generated style data bind

Deadly 提交于 2021-01-29 11:00:48
问题 I'm using the vue-cli 3 and want to generate background-image paths. Therefore I'm using the style data bind within an v-for-loop. the component: <template> <ul> <li v-for="(tool, index) in tools" :key="index"> <a href="#" :style="{ backgroundImage: 'url(@/assets/icons/' + tool + '.svg)' }"></a> </li> </ul> </template> <script> export default { props: { tools: Array, } } </script> The images are in this folder: src/assets/icons/xxx.svg The problem is, that the generated image path seems to be

use element ui upload Multiple pictures how to get the picture path store in imgarr arrary

爱⌒轻易说出口 提交于 2021-01-29 10:57:22
问题 enter image description here the response data such like that, how to store the res.imgarr 回答1: You can use the file-list data field, which holds the default uploaded files. Here is the doc: http://element.eleme.io/#/en-US/component/upload Js Fiddle example: https://jsfiddle.net/h634yrf5/ Check the console log when you add new file in the attached example and you will notice the list of files. 来源: https://stackoverflow.com/questions/52472854/use-element-ui-upload-multiple-pictures-how-to-get

Configuration for Debugging Mocha Unit Tests in Vue.js with VSCode

一个人想着一个人 提交于 2021-01-29 10:55:39
问题 I am currently facing some problems getting my tests to debug properly with VSCode in Vue.js (I am using Mocha and Webpack) The first configuration I found which got me a bit closer was this one. Configuration in .vscode/launch.json { "type": "node", "request": "launch", "name": "Unit Tests", "program": "${workspaceFolder}/node_modules/@vue/cli-service/bin/vue-cli-service.js", "args": [ "test:unit" ], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" } Now this solution

File upload with ASP.NET Core + VueJS

你。 提交于 2021-01-29 10:53:43
问题 I have ASP.NET core , VueJS app. The task is to Upload file with form data Problem: Form data is null Here is the HTML and JS class I have. Its using Jquery Ajax call to upload model data + file. I am unable to use 3rd libraries as Axios (at least I dont know how) , but pure Jquery. Does anybody have suggestion how this can work ? HTML <form method = "post" enctype = "multipart/form-data" role = "form" v - on: submit.prevent > <div id = "formEditInner" > ... <div class = "form-group" > <label

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

Vue.js component parent event

好久不见. 提交于 2021-01-29 10:36:34
问题 im wondering why my code isn't working. I have an event 'leave' which should be called on blur. The components are displayed properly but when i leave the inputs the event wont be triggered. Vue.component('text-input', { props:['args'], template: '<input :id="args.id" :type="args.type"/>' }) App = new Vue({ el : '#app', data: { inputs : [ { id : 'nickname', type : 'text'}, { id : 'email' , type:'email'}, ] }, methods : { leave : function(event) { var id = $(event.target).attr('id'); console

WebRTC视频推流播放平台前端获取视频流列表错误是什么原因?

做~自己de王妃 提交于 2021-01-29 10:18:42
在之前关于WebRTC的研发当中,我们实现了基于WebRTC的视频推流和播放,但是该方案目前还有不完善的地方,因此我们目前仍在不断优化当中。 前几天我们又重新对WebRTC推流做了测试,打开webrtc client页面,并推一个摄像头视频流,发现此次出现报错: Error in render: “TypeError: Cannot read property ‘length’ of undefined” Found in xxxxxx 分析问题 producers这个属性值是从服务端获得;前端页面使用的是Vue制作,只有没有producers属性在页面渲染节点才会报错,所以在渲染的原数据的源头先输入console.log,查看原数据信息,如下图: 然后在浏览器重新运行,查看log显示的内容,如下图: 发现此处没有视频的id,而在Vue的项目中使用了producers.length这个属性,但是原数据没有这个属性,导致报错。在vue的代码渲染如下图: 解决问题 需要在数据的源头来解决问题;要验证producers属性有没有即可。 来源: oschina 链接: https://my.oschina.net/u/4619556/blog/4933269

Displaying RSS feed on Vue.js frontend

断了今生、忘了曾经 提交于 2021-01-29 10:17:31
问题 I want to display a google alert feed on my "Dashboard.vue" from the component "Feed.vue". I got this working in javascript but not sure how to convert my js front end to Vue. I am getting the error: io is not defined. Any ideas as to how I can resolve this and display the articles from the feed on my Vue.js application? Backend code: const feedparser = require('feedparser-promised'); const express = require('express'); const app = express(); const server = require('http').Server(app); const

Vuex LocaleStorage plugin for nuxt.js

↘锁芯ラ 提交于 2021-01-29 10:17:09
问题 In my project, I faced with a problem the cookie technology and I can't use it because my client gets problems with it because cookies should have some button for notification, and the user might not approve it. My question is: Are there any solutions (modules possible) to solve such problems? If yes - what can you recommend first of all? In my project, I need to get data in middleware(in SSR mode) from VUEX and I need to save it after refresh pages. If it possible - need to save session data

JS批量导入execel、下载模板文件功能(结尾有VUE教程)

跟風遠走 提交于 2021-01-29 10:15:53
事先准备: 第1步:先导入excel处理的插件,网上下载。 <script type="text/javascript" src="../js/xlsx.core.min.js"></script> <script type="text/javascript" src="js/xlsx.full.min.js"></script> 第2步:先建个execel模板,导入到项目文件中。例如: 最后我们可以编写代码了: 先上HTML吧,这样好理解js的内容,不然都不止DOM是干嘛的 <!-- 导入按钮 --> <div id="label-import" class="label-import" > <span style="color: #FFFFFF;margin-left: 10px;">批量导入</span> <!-- 顶部 --> <div id="import_dingbu"> <a href = "javascript:void(0)" onclick = "closeImport()" id="import_dingbu_close"><img src="img/03_part/tk_button_close_press.png" style=""></a> </div> <!-- dialog_dingbu --> <!-- 中部 --> <div id="import