小编Eri*_*rth的帖子

IE11 - 对象不支持属性或方法'includes' - javascript window.location.hash

我正在检查网址,看它是否包含或包含?在其中控制窗口中的哈希弹出状态.所有其他浏览器只有IE的问题.

当我尝试以这种方式加载时,调试器给我这个错误Object不支持属性或方法'includes'

当我通过popstate加载页面时,我没有收到任何错误

    $(document).ready(function(e) {
        if(window.location.hash) {
            var hash;
            if(window.location.hash.includes("?")) {
                alert('I have a ?');
                hash = window.location.hash.substring(window.location.hash.indexOf('#') + 0,window.location.hash.indexOf('?'));
            }else {
                hash = window.location.hash;
            };
            if (hash=="#DRS" || hash=="#DRP" || hash=="#DFFI" || hash=="#DCI" || hash=="#DCP" || hash=="#DRP" || hash=="#DRMA" || hash=="#EICS" || hash=="#ORG"){
                $(hash+'Content').addClass('pageOn').removeClass('pageOff');
            }else {
                $('#homeContent').addClass('pageOn').removeClass('pageOff');
            };
        } else {
            $('#homeContent').addClass('pageOn').removeClass('pageOff');
        }
        $(window).on('popstate', function() {
            var hash;
            if(window.location.hash.includes("?")) {
                hash = window.location.hash.substring(window.location.hash.indexOf('#') + 0,window.location.hash.indexOf('?'));
            }else {
                hash = window.location.hash;
            };
            if (hash=="#DRS" || hash=="#DRP" || hash=="#DFFI" || hash=="#DCI" …
Run Code Online (Sandbox Code Playgroud)

javascript internet-explorer-11 ecmascript-7

168
推荐指数
5
解决办法
13万
查看次数

如何在C#中将这些变量写入一行代码?

我是C#的新手,字面上是第50页,我很好奇如何在一行代码中编写这些变量:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace consoleHelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {

            int mon = DateTime.Today.Month;
            int da = DateTime.Today.Day;
            int yer = DateTime.Today.Year;
            var time = DateTime.Now;

            Console.Write(mon);
            Console.Write("." + da);
            Console.WriteLine("." + yer);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我来自JavaScript,在哪里这样做,它看起来像这样:

document.write(mon+'.'+da+'.'+yer);
Run Code Online (Sandbox Code Playgroud)

任何帮助在这里表示赞赏.

c# int console var console.writeline

17
推荐指数
4
解决办法
10万
查看次数

推送通知在Firebase 4.0中无效

我今天更新了我的pod到新的Firebase 4.0.我完成了建议的更改并从Github示例中获取了代码.我会说实话,我不知所措,我拿着FCM令牌并从firebase控制台发送消息,我什么也得不到.

我刷新,它说消息已发送,但我检查控制台和设备,没有任何东西.我错过了什么?

这是我的appdelegate:

//
//  Created by Erik Grosskurth on 4/24/17.
//

import UIKit
import FirebaseAnalytics
import FirebaseInstanceID
import FirebaseMessaging
import UserNotifications
import SystemConfiguration
import MobileCoreServices
import Quickblox
import QuickbloxWebRTC


let kQBApplicationID:UInt = 3545252534
let kQBAuthKey = "udfgsegsetrgsextr"
let kQBAuthSecret = "setbsetbsetbsetrbset"
let kQBAccountKey = "sbrtsbrtbsrtbsrtbrt"

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    let gcmMessageIDKey = "gcm.message_id"

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        // [START register_for_notifications]

        FirebaseApp.configure()

        Messaging.messaging().delegate = self

        if #available(iOS …
Run Code Online (Sandbox Code Playgroud)

push-notification ios firebase swift3 firebase-cloud-messaging

11
推荐指数
1
解决办法
8072
查看次数

通过AJAX Post将数据传递给CFC使用JSON

我有一个jquery提交事件,它收集表单数据并将其放入jquery对象.我想获取该jquery对象并将其传递给coldfusion Web服务,我可以使用它来更新xml文件.我不希望Web服务的响应,我只想将其发送到Web服务并从那里调整数据.

客户端/ JQuery:

$("#update").on('submit',function() {
    $linkName = $('#update').find('#linkName').val();
    $linkURL = $('#update').find('#linkURL').val();
    $linkInfo = $('#update').find('#linkDesc').val();
    $numOfLinks = $('.linkSection').length;
    if ($numOfLinks > 0){
    // Here the sub link names and urls put into an array
        $subLinkName = [];
        $subLinkURL = [];   
        $('.linkSection').each(function(index, element) {
            $subLinkName.push($(this).find('#subLinkName').attr('value'));
            $subLinkURL.push($(this).find('#subLinkURL').attr('value'));

            $data = {linkName: $linkName, linkURL: $linkURL, linkID : $linkID, linkDescription : $linkInfo, subLinkNames : $subLinkName, subLinkURLs : $subLinkURL}; 
        });
    // Optionally, you could put the name and url in the array object here but not …
Run Code Online (Sandbox Code Playgroud)

coldfusion jquery json web-services

6
推荐指数
1
解决办法
3617
查看次数

反应 onclick 数据值返回 null

我正在尝试将我的状态对齐更改为:左对齐、居中对齐、右对齐或对齐,具体取决于<Icon />我单击的对齐方式。但是,e.target.getAttribute('data-value')正在返回null

当我更改<Icon icon="align-left" />by 时left,它正在工作。e.target.getAttribute('data-value')正在返回数据值。

所以,我怎样才能改变我的状态,以左,右中心或我的点击自圆其说<Icon />

class TextStyleParams extends React.Component {
  constructor(props) {
    super(props);
    this.onClickAlignment = this.onClickAlignment.bind(this);

    this.state = {
      textStyle: {
        alignment: 'left',
        ...,
      },
    };
  }

  onClickAlignment(e) {
    const { textStyle } = this.state;
    const newTextStyle = {
      ...textStyle,
      alignment: e.target.getAttribute('data-value'),
    };
    this.setState({ textStyle: newTextStyle });
    this.props.updateTextStyle(newTextStyle);
  }
    
  render() {
    const { textStyle } = this.state;
        
    return (
      <div>
        <span role="button" onClick={this.onClickAlignment} …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

6
推荐指数
1
解决办法
1489
查看次数

单元测试 React Native:NativeModules.RNViewShot 未定义。确保库已链接到本机端

当我对应用程序中的各个组件运行一些单元测试时,我不断收到这个恼人的警告:

NativeModules.RNViewShot is undefined. Make sure the library is linked on the native side.
Run Code Online (Sandbox Code Playgroud)

在我的根目录中,我运行'react-native link'并在控制台中看到:

rnpm-install info Platform 'ios' module react-native-view-shot is already linked
rnpm-install info Platform 'android' module react-native-view-shot is already linked
rnpm-install info Linking assets to ios project
rnpm-install info Linking assets to android project
rnpm-install info Assets have been successfully linked to your project
Run Code Online (Sandbox Code Playgroud)

这里给出了什么 > ?

Platform: MacOS,
Editor: VSCode,
react: "16.4.0",
react-native: "0.54.2",
react-native-view-shot: "^2.4.0",
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs react-native

6
推荐指数
1
解决办法
2010
查看次数

谷歌地图Javascript API V3在移动/本机应用程序中找不到404

我可以让谷歌地图在浏览器中显示没有问题.当我使用phonegap构建打包我的应用程序时,它不起作用.在我的远程调试会话中,它说

https://maps.googleapis.com/maps/api/js?key=My_Key_Goes_Here 
Failed to load resource: the server responded with a status of 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)

在我的文档的负责人:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MyKey"></script>
<script src="js/locations.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)

在网络控制台中,我得到:

Request URL:http://maps.googleapis.com/maps/api/js?key=MyKeyHere
Request Method:GET
Status Code:404 Not Found (from cache)
Response Headers
Client-Via:shouldInterceptRequest
Request Headers
Provisional headers are shown
Accept:*/*
User-Agent:Mozilla/5.0 (Linux; Android 5.0.2; SM-T530NU Build/LRX22G; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Safari/537.36
Query String Parameters
view source
view URL encoded
key: MyKeyDisplayedHere
Run Code Online (Sandbox Code Playgroud)

在我的config.xml文件中,我包含以下行:

<preference name="orientation" value="portrait" />
<preference name="Fullscreen" value="true" />
<access origin="*://*.googleapis.com/*" subdomains="true" …
Run Code Online (Sandbox Code Playgroud)

android whitelist google-maps-api-3 jquery-mobile phonegap-build

2
推荐指数
1
解决办法
2063
查看次数

ios 10 +,Swift 3+ - 无法从Singleton实例中解除UIAlertController

我创建了一个覆盖来运行,同时我向服务器运行异步数据抓取,这样用户就不会继续按下UI中的按钮,直到数据抓取完成.我已经将函数放入一个全局单例类中,并在传入bool时调用它来说明我是否要显示或隐藏.我可以让它显示,但我不能让它隐藏.这是代码:

class DataModel {
    static let sharedInstance = DataModel()
    func accessNetworkData(vc: UIViewController, params: [String:Any], wsURLPath: String, completion: @escaping (_ response: AnyObject) -> ()) {
        DataModel.sharedInstance.toggleModalProgess(show: true)
        // SHOW THE MODAL HERE ONCE THE DATA IS REQUESTED.
        let url = URL(string: wsURLPath)!
        let session = URLSession.shared
        var request = URLRequest(url: url)
        request.httpMethod = "POST"
        do { request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted) } catch let error { print(error.localizedDescription) }
        request.addValue("application/json", forHTTPHeaderField: "Content-Type")
        request.addValue("application/json", forHTTPHeaderField: "Accept")
        let task = session.dataTask(with: request …
Run Code Online (Sandbox Code Playgroud)

singleton ios dispatch-async swift uialertcontroller

2
推荐指数
1
解决办法
1431
查看次数

有人能告诉我为什么我在经典 asp 中没有收到对 MSXML2.ServerXMLHTTP.6.0 的响应吗?

有人能告诉我为什么我没有得到回应吗?

<%
    RssURL = "https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=nrcGOV"

    Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
    xmlHttp.setProxy 2, "www.proxy.mydomain.com:80"
    xmlHttp.Open "Get", RssURL, false
    xmlHttp.Send()
    myXML = xmlHttp.ResponseText
    myXMLcode = xmlHttp.ResponseXML.xml

    response.Write(myXML)
    response.Write(myXMLcode)
    response.Write("hey")
%>
Run Code Online (Sandbox Code Playgroud)

我正在尝试从 twitter api 获取 rss feed xml 到我的服务器上,在那里我可以使用客户端代码对其进行操作。有人可以告诉我为什么我没有使用此代码获取提要吗?

xml rss response serverxmlhttp asp-classic

1
推荐指数
1
解决办法
5675
查看次数