提交 cbabf026 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(h5): getElementById

上级 3be90a2f
......@@ -34,6 +34,7 @@
"getAppBaseInfo",
"getClipboardData",
"getDeviceInfo",
"getElementById",
"getEnterOptionsSync",
"getFileInfo",
"getImageInfo",
......
......@@ -22913,6 +22913,13 @@ const setRightWindowStyle = /* @__PURE__ */ defineSyncApi("setRightWindowStyle",
state2.rightWindowStyle = style;
}
});
const getElementById = /* @__PURE__ */ defineSyncApi(
"getElementById",
(id2) => {
const uniPageBody = document.querySelector("uni-page-body");
return uniPageBody ? uniPageBody.querySelector(`#${id2}`) : null;
}
);
const saveImageToPhotosAlbum = /* @__PURE__ */ defineAsyncApi(
API_SAVE_IMAGE_TO_PHOTOS_ALBUM,
createUnsupportedAsyncApi(API_SAVE_IMAGE_TO_PHOTOS_ALBUM)
......@@ -23057,6 +23064,7 @@ const api = /* @__PURE__ */ Object.defineProperty({
getAppBaseInfo,
getClipboardData,
getDeviceInfo,
getElementById,
getEnterOptionsSync,
getFileInfo,
getImageInfo,
......@@ -25542,6 +25550,7 @@ export {
getClipboardData,
getCurrentPages$1 as getCurrentPages,
getDeviceInfo,
getElementById,
getEnterOptionsSync,
getFileInfo,
getImageInfo,
......
......@@ -22887,6 +22887,13 @@ const setRightWindowStyle = /* @__PURE__ */ defineSyncApi("setRightWindowStyle",
state2.rightWindowStyle = style;
}
});
const getElementById = /* @__PURE__ */ defineSyncApi(
"getElementById",
(id2) => {
const uniPageBody = document.querySelector("uni-page-body");
return uniPageBody ? uniPageBody.querySelector(`#${id2}`) : null;
}
);
const saveImageToPhotosAlbum = /* @__PURE__ */ defineAsyncApi(
API_SAVE_IMAGE_TO_PHOTOS_ALBUM,
createUnsupportedAsyncApi(API_SAVE_IMAGE_TO_PHOTOS_ALBUM)
......@@ -23031,6 +23038,7 @@ const api = /* @__PURE__ */ Object.defineProperty({
getAppBaseInfo,
getClipboardData,
getDeviceInfo,
getElementById,
getEnterOptionsSync,
getFileInfo,
getImageInfo,
......@@ -25516,6 +25524,7 @@ export {
getClipboardData,
getCurrentPages$1 as getCurrentPages,
getDeviceInfo,
getElementById,
getEnterOptionsSync,
getFileInfo,
getImageInfo,
......
......@@ -65,6 +65,7 @@ export * from './ui/startPullDownRefresh'
export * from './ui/stopPullDownRefresh'
export * from './ui/tabBar'
export * from './ui/window'
export * from './ui/getElementById'
export * from './todo/index'
......
import { defineSyncApi } from '@dcloudio/uni-api'
type GetElementById = (id: string) => Element | null
export const getElementById = defineSyncApi<GetElementById>(
'getElementById',
(id: string) => {
const uniPageBody = document.querySelector('uni-page-body')
return uniPageBody ? uniPageBody.querySelector(`#${id}`) : null
}
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册