草庐IT

basic_string_view

全部标签

javascript - 我无法测试在主干 View 中呈现的元素的可见性

我正在开发一个Backbone.js应用程序,同时使用Jasmine&Sinon添加测试我在确定某些DOM元素的可见性时遇到了问题:其中一些在测试中被检测为不可见,而我可以在我的应用程序中正确地看到它们。我创建了一个复制问题的小示例,同一测试在两组元素上运行两次:第一组直接存在于SpecRunner.html中第二个已呈现为BackboneView测试本身使用jQuery.is(':visible')(通过jasmine-jquery的.toBeVisible())来了解元素是否可见。它通过了第一组,而不是第二组。我在这里将代码作为github项目共享:https://github.c

javascript - meteor -shopify : expected String to be a Hash

我正在使用froatsnook:shopify尝试修改自定义集合的元字段。服务器JS/***ModifyShopifyCustomCollectionMetafields*@requestPUT/admin/custom_collections/#{id}.json**@param{Number}collection_id*@param{Object}collection_data*@param{Function}callback*/modifyShopifyCustomCollectionMetafields:function(collection_id,collection_dat

javascript - 另一个ajax中的vue js ajax正在获取数据但不呈现 View

有一种情况,我必须在vuejs中的第一个ajax(在mounted函数中)之后获取额外的数据,我将第二个ajax放在if条件中并且在第一个ajax的success函数中!它正在运行,我在chrome的VueDevtools中看到数据,但数据未在View中呈现。伪代码:varvm=newVue({el:'#messages',data:{participants:[],active_conversation:'',messages:[]},methods:{getParticipants:function(){returnthis.$http.post('message/get-part

javascript - 不能使用 String#trim 作为 Array#map 的回调

出于某种原因,我不能使用String.prototype.trim.call作为数组方法的回调,例如map或filter.在这种情况下,两个函数工作相同:functiontrim(string){returnstring.trim();}varstring='A';trim(string);//'A'String.prototype.trim.call(string);//'A'但是,当我尝试将它们作为数组方法的回调传递时,第二个失败了:vararray=['A','B','C'];array.map(trim);//['A','B','C'];array.map(String.pro

c# - 在 C# 中等效的 Javascript atob(string)

我这样做了:byte[]data=Convert.FromBase64String(str);stringdecodedString=Encoding.UTF8.GetString(data);Console.WriteLine(decodedString);但得到了未处理的异常:System.FormatException:Base-64字符数组或字符串的长度无效。在javascript中使用atob(str)给我正确的解码字符串。javascript控制台:atob("eyJpc3MiOiJodHRwczovL2lkZW50aXR5LXN0YWdpbmcuYXNjZW5kLnh5e

javascript - Node/ express : Error: Failed to lookup view "error" in views directory

我将我的nodejs模板引擎切换到了ejs(来自jade)。当我使用我的ejs模板运行我的app.js时,我收到一系列“无法在View中查找View‘错误’”日志。其中一些包括:GET/css/bootstrap.min.css50012.588ms-1390Error:Failedtolookupview"error"inviewsdirectory...GET/css/clean-blog.min.cssError:Failedtolookupview"error"inviewsdirectory...GET/js/bootstrap.min.jsError:Failedtoloo

javascript - 获取行数据失败,错误 Cannot create property 'guid' on string

我正在使用jquery数据表。当我尝试检索行数据时,出现了Cannotcreateproperty'guid'onstring错误。http://jsfiddle.net/rqx14xepvaremployersTable=$('#employersTable').DataTable();$('#add').click(function(){addRow($('.username').val(),$('.phone').val());});$('body').on('click','#employersTabletr',retrieveRow(this));functionaddRow

javascript - 我无法准确理解 JavaScript 的方法 string.match(regexp) 的 g 标志是如何工作的

在《JavaScript:TheGoodParts》一书中解释了方法string.match(regexp)如下:Thematchmethodmatchesastringandaregularexpression.Howitdoesthisdependsonthegflag.Ifthereisnogflag,thentheresultofcallingstring.match(regexp)isthesameascallingregexp.exec(string).However,iftheregexphasthegflag,thenitproducesanarrayofallthem

javascript - 将挖空 View 模型拆分为多个文件

我的View模型开始变得非常大,所以我决定将它分成多个文件。我已经尝试了许多不同的方法,但没有任何效果。我的View模型如下所示:namespace.model=function(constructorParam){varself=this;self.param1=ko.observable(constructorParam.param1);self.param2=ko.observable(privateFunction(constructorParam));self.clickEvent=function(){//dosomethingwithparams//callsomepri

javascript - Angular UI 路由器嵌套 View

我有这样的结构:我希望能够像下面这样在主状态下定义模板,而不必在子状态下进行管理。.state('state1',{url:'/',views:{'main':{templateUrl:'/modules/blog/partials/index.html',controller:'BlogController'},'sidebar':{templateUrl:'/modules/core/partials/sidebar.html'}}});我希望名为sidebar的ui-view不是main的子状态,而是由main状态的View填充对象而不是子状态的templateUrl字段。我该怎