ui.url.set
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
กำหนดค่าของส่วนย่อย URL ของหน้าเว็บ โดยส่วนนี้จะเข้ารหัสพจนานุกรมของคีย์และค่า หากระบุพจนานุกรมเป็นอาร์กิวเมนต์แรก ระบบจะเข้ารหัสคู่คีย์/ค่าในพจนานุกรมนั้นและแทนที่ส่วนย่อยของ URL ปัจจุบัน หากระบุสตริงคีย์ ระบบจะอัปเดตเฉพาะคีย์นั้น (และค่าของคีย์ ซึ่งเป็นอาร์กิวเมนต์ที่ 2) ส่วนที่เหลือของส่วนย่อย URL จะไม่เปลี่ยนแปลง
การใช้งาน | การคืนสินค้า |
---|
ui.url.set(keyOrDict, value) | |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
keyOrDict | Dictionary<Object>|String | คีย์เพื่ออัปเดตค่าเดียวในส่วนย่อยของ URL หรือพจนานุกรมของคู่คีย์/ค่าที่จะแทนที่ส่วนย่อยของ URL ที่มีอยู่ ค่าในพจนานุกรมต้องเป็นประเภทสตริง ตัวเลข หรือบูลีน |
value | บูลีน|ตัวเลข|สตริง ไม่บังคับ | ค่าใหม่ที่จะเชื่อมโยงกับคีย์เดียว ต้องระบุเมื่ออาร์กิวเมนต์แรกเป็นสตริง และระบบจะละเว้นในกรณีอื่นๆ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003e\u003ccode\u003eui.url.set\u003c/code\u003e lets you modify the URL fragment, which stores data as key-value pairs.\u003c/p\u003e\n"],["\u003cp\u003eYou can either replace the entire fragment with a new dictionary or update a single key's value.\u003c/p\u003e\n"],["\u003cp\u003eDictionary values in the URL fragment must be strings, numbers, or booleans.\u003c/p\u003e\n"]]],[],null,["# ui.url.set\n\n\u003cbr /\u003e\n\nSets the value of the page's URL fragment. The fragment encodes a dictionary of keys and values. If a dictionary is supplied as the first argument, the key/value pairs in that dictionary will be encoded and replace the current URL fragment. If a key string is provided, then only that key (and its value, the second argument) are updated, and the rest of the URL fragment is unchanged.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------|---------|\n| `ui.url.set(keyOrDict, `*value*`)` | |\n\n| Argument | Type | Details |\n|-------------|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `keyOrDict` | Dictionary\\\u003cObject\\\u003e\\|String | Either a key to update a single value in the URL fragment, or a dictionary of key/value pairs which will replace the existing URL fragment. Dictionary values must be of type string, number, or boolean. |\n| `value` | Boolean\\|Number\\|String, optional | The new value to associate with a single key. This is required when the first argument is a string and is otherwise ignored. |"]]