Options
All
  • Public
  • Public/Protected
  • All
Menu

Class URI

URI Class
URI specs: scheme://username:password@host:port/path?query#fragment
Example: http://jsdk:1234@github.com:8080/classes/URI?k1=v1#frag1

Hierarchy

  • URI

Index

Constructors

constructor

  • Parameters

    • Optional cfg: string | URL | URIData

    Returns URI

Methods

fragment

  • fragment(): string
  • fragment(str: string): this
  • Returns fragment of the URI.
    返回URI的标签部分。

    Returns string

  • Sets fragment of the URI.
    设置URI的标签部分。

    Parameters

    • str: string

    Returns this

host

  • host(): string
  • host(str: string): this
  • Returns host of the URI.
    返回URI的主机。

    Returns string

  • Sets host of the URI.
    设置URI的主机部分。

    Parameters

    • str: string

    Returns this

isAbsolute

  • isAbsolute(): boolean
  • Returns true if the URL has host.
    如果有主机地址则是绝对地址,否则是相对地址。

    Returns boolean

password

  • password(): string
  • password(str: string): this
  • Returns password of the URI.
    返回URI的密码。

    Returns string

  • Sets password of the URI.
    设置URI的密码。

    Parameters

    • str: string

    Returns this

path

  • path(): string
  • path(str: string): this
  • Returns path of the URI.
    返回URI的路径字符串。

    Returns string

  • Sets path of the URI.
    设置URI的路径部分。

    Parameters

    • str: string

    Returns this

port

  • port(): number
  • port(port: number): this
  • Returns port of the URI.
    返回URI的端口。

    Returns number

  • Sets port of the URI.
    设置URI的端口。

    Parameters

    • port: number

    Returns this

query

  • query(key: string): string
  • query(key: string, value: string, encode?: boolean): this
  • Returns value of a query key.
    返回某个键的值。

    Parameters

    • key: string

    Returns string

  • Sets value of a query key.
    设置某个键的值。

    Parameters

    • key: string
    • value: string
    • Optional encode: boolean

    Returns this

queryObject

  • Returns json data of all query keys.
    返回所有的键值JSON。

    Returns JsonObject<string>

  • Sets values of input query keys.
    设置输入的键值。

    Parameters

    • params: JsonObject<string>
    • Optional encode: boolean

    Returns this

queryString

  • queryString(): string
  • queryString(str: string): this
  • Returns query string of the URI.
    返回URI的查询字符串。

    Returns string

  • Sets query string of the URI.
    设置URI的查询字符串。

    Parameters

    • str: string

    Returns this

scheme

  • scheme(): string
  • scheme(str: string): this
  • Returns scheme of the URI.
    返回URI的协议。

    Returns string

  • Sets scheme of the URI.
    设置URI的协议。

    Parameters

    • str: string

    Returns this

toAbsolute

  • toAbsolute(): string
  • Returns an absolute URI string.
    返回绝对地址。

    Returns string

toRelative

  • toRelative(): string
  • Returns a relative URI string.
    返回相对地址。

    Returns string

toString

  • toString(): string
  • Returns absolute of relative string of the URI according to whether it has host.
    依据其是否有主机地址,返回绝对或相对地址

    Returns string

user

  • user(): string
  • user(str: string): this
  • Returns user name of the URI.
    返回URI的用户名。

    Returns string

  • Sets user name of the URI.
    设置URI的用户名。

    Parameters

    • str: string

    Returns this

userinfo

  • userinfo(): string
  • Returns username+password of the URI.
    The format is: {username:password}.
    返回用户信息,格式如下:{username:password}。

    Returns string

Static getAbsoluteDir

  • getAbsoluteDir(): any
  • Returns the absolute dir of current URL.
    返回当前URL的绝对目录。

    Returns any

Static parseQueryString

Static toAbsoluteURL

  • toAbsoluteURL(url: string): string
  • Convert an URL to absolute URL according to the current page address.
    无论是相对地址还是绝对地址,都按照当前页面地址转换为绝对地址。

    Parameters

    • url: string

    Returns string

Static toQueryString