草庐IT

vue-video

全部标签

javascript - Spring stomp websockets with vue.js

我正在尝试将Springwebsockets(STOMP)与Vue结合使用,但不知道该怎么做,甚至不知道该怎么做。我的websockets使用纯JS,但是当我尝试使用Vue时,我卡住了。这是我的Vue代码:varapp=newVue({el:'#app',data:{stompClient:null,gold:0},methods:{sendEvent:function(){this.stompClient.send("/app/hello",{},JSON.stringify({'name':$("#name").val()}));}},created:function(){this

javascript - [Vue 警告] : Error in render function: "TypeError: Cannot read property ' first_name' of null"

我有以下Navigation.vue组件:{{user.first_name}}import{mapActions,mapGetters}from'vuex'exportdefault{name:'hello',methods:{...mapActions(['myAccount'])},mounted:function(){if(localStorage.getItem('access_token')){this.myAccount()}},computed:{...mapGetters(['user'])}}此代码返回:[Vuewarn]:Errorinrenderfunction

javascript - Vue - 使用 refs 来聚焦元素目标

点击spanclass="before-click"时,我想隐藏它,而是显示inputclass="after-click"。并且出现的输入标签必须是焦点!问题是当我尝试使用$refs.afterClick访问那个DOM并给它.focus()时,一个意外错误显示.focus()不是一个函数。如何解决这个问题?谢谢。varmyApp=newVue({el:'#app',data:{onEdit:false,msg:'Somethinginhere',},methods:{switchAndFocus(){if(!this.onEdit){this.onEdit=true;this.$re

javascript - <video> 标签上的 iPad 触摸事件

我正在iPad上构建一个由javascript支持的画廊,它可以同时显示图像和视频。要浏览图库,您可以向左或向右滑动(类似于iPad的照片应用程序)。但是,在元素上滑动时,我的所有触摸事件都不起作用。它似乎接管了我的触摸事件,即使在可能具有更高z-index的元素上也是如此。我尝试添加一个调用e.preventDefault()的touchmove处理程序,但这似乎也不起作用。有没有其他人遇到过这个问题并找到了解决方案? 最佳答案 您的触摸事件正在被播放器的默认控件吸收。如果将视频元素的控件设置为false,则可以完全控制视频元素上

javascript - 数据更新后触发的 Vue.js 事件

我有一个Vue.js应用程序,我有几个组件用于处理一些重复性任务。我还从AJAX请求中获取数据。我想要一些输入是,如果有一个事件在Vue数据(treeData和flatTreeData)被更新和操作后触发,以便我可以执行还有其他操作吗?varapp=newVue({el:'body',data:{treeData:{items:{}},flatTreeData:[],},});$.getJSON('./paths.json').done(function(data){//applythefilestructuretothevueappdemo.treeData=data;demo.fl

javascript - Vue mousemove 仅在 mousedown 之后

如何仅在先单击元素时才触发mousemove?我正在尝试将其用于音频播放器时间轴。.player__time--bar(@mousedown="setNewCurrentPosition($event)").slider(role="slider"aria-valuemin="0":aria-valuenow="currentPosition":aria-valuemax="trackTotalDuration"aria-orientation="horizontal").player__time--bar-current-position(:style="{width:(100/(t

javascript - 添加自定义 Video.js 控制栏按钮

我已经在video.js上工作了一天,所以在谈到这些东西时我是一个真正的新手今天我只是想添加一个按钮来在两个视频之间切换。我在jQuery中快速简单地完成了它。但我宁愿用javascript来做,以便更好地理解video.js作为一个整体。到目前为止完成:1.我已经从github下载了最新版本的video.js。2.播放器工作得很好。3.通读指南。4.尝试了他们的示例代码。他们的按钮创建代码:varmyButton=video.controlBar.addChild('MyButton',{text:'PressMe',children:{buttonChildExample:{but

javascript - Vue 2 - 如何在 Prop 中设置默认数组类型

我有我的Vue组件,它以一组对象作为Prop。我经常使用prop验证,尤其是对于“默认”值功能。在这种情况下,我有:props:{items:Array}但我希望它像Typescript或React一样:props:{items:Array.of({key:{type:String,default:'myText'}})}等等有可能实现吗?否则我需要使用计算数据作为map来设置默认值 最佳答案 我创建了示例:jsFiddle,这可能会对您有所帮助,是的...您可以将默认值作为数组返回:ES6props:{items:{type:Ar

javascript - 如何在vue中创建警告确认框

我想在删除文件之前显示一个对话框,我如何使用vue做到这一点?这是我的尝试我的删除文件按钮Delete这是我的删除方法DeleteUser(id,index){axios.delete('/api/artist/'+id).then(resp=>{this.artists.data.splice(index,1);}).catch(error=>{console.log(error);})},对话框正在显示,但无论我选择什么,它都会继续删除文件。 最佳答案 试试这个DeleteDeleteUser(id,index){if(conf

javascript - Vue.js 拦截器

如何在vue.js中使用拦截器?所以在每个请求/响应之前,它应该首先去拦截器。我已经搜索了很多,但找不到相关的好文档。我想像这样使用JWTAuth:(function(define){'usestrict'define(function(require){varinterceptorinterceptor=require('rest/interceptor')/***AuthenticatestherequestusingJWTAuthentication**@param{Client}[client]clienttowrap*@param{Object}config**@return