Skip to content
Mithril.js 2
Main Navigation ガイドAPI

日本語

English
简体中文
繁體中文
Español
Français
Русский
Português – Brasil
Deutsch
한국어
Italiano
Polski
Türkçe
čeština
magyar

日本語

English
简体中文
繁體中文
Español
Français
Русский
Português – Brasil
Deutsch
한국어
Italiano
Polski
Türkçe
čeština
magyar

外観

Sidebar Navigation

API

コア API

m(selector, attributes, children)

render(element, vnodes)

mount(root, component)

route(root, defaultRoute, routes)

request(options)

parseQueryString(string)

buildQueryString(object)

buildPathname(object)

parsePathname(文字列型)

trust(html)

fragment(attrs, children)

redraw()

censor(object, extra)

オプション API

stream()

ガイド

このページの内容

buildPathname(object) ​

Description ​

パスのテンプレートとパラメータオブジェクトから、/path/user?a=1&b=2 形式の文字列を生成します。

javascript
var pathname = m.buildPathname('/path/:id', { id: 'user', a: '1', b: '2' });
// "/path/user?a=1&b=2"

Signature ​

pathname = m.buildPathname(path, query)

ArgumentTypeRequiredDescription
pathStringYesURL パス
queryObjectYes文字列に変換されるキーと値のマップ
returnsStringクエリ文字列を含む URL を示す文字列

How to read signatures

How it works ​

m.buildPathname は、パスのテンプレートとパラメータオブジェクトから パス名 を生成します。URL の構築を支援し、m.route や m.request が内部でパスを組み立てる際に使用されます。パス名に追加するクエリパラメータは、m.buildQueryString を使用して生成できます。

javascript
var pathname = m.buildPathname('/path/:id', { id: 'user', a: 1, b: 2 });

// pathname is "/path/user?a=1&b=2"
Pager
前のページbuildQueryString(object)
次のページparsePathname(文字列型)

MITライセンス の下で公開されています。

Copyright (c) 2024 Mithril Contributors

https://mithril.js.org/buildPathname.html

MITライセンス の下で公開されています。

Copyright (c) 2024 Mithril Contributors