@v-miniapp/apis
v1.0.17
Published
**@v-miniapp/apis** là bộ thư viện JavaScript API được thiết kế đặc biệt cho việc phát triển V-App.
Readme
@v-miniapp/apis
@v-miniapp/apis là bộ thư viện JavaScript API được thiết kế đặc biệt cho việc phát triển V-App.
📚 Tài liệu chính thức: Tổng quan về API | V-MiniApp
Cài đặt
# PNPM
pnpm install @v-miniapp/apis
# YARN
yarn install @v-miniapp/apis
# NPM
npm install @v-miniapp/apisCách gọi JSAPI
Sử dụng JS APIs dạng Sync
Sử dụng sync function sẽ cần có 3 callback: success, failed, complete
import apis from '@v-miniapp/apis'
apis.alert({
title: 'Alert title',
content: 'Alert content',
buttonText: 'OK',
success: data => {
console.log('User acknowledged alert', data)
},
failed: err => {
console.error('Alert error', err)
},
complete: () => {
console.log('Alert finished')
},
})Sử dụng JS APIs dạng Sync
import apis from '@v-miniapp/apis/async'
try {
const data = await apis.alert({
title: 'Alert title',
content: 'Alert content',
buttonText: 'OK',
})
console.log('User acknowledged alert', data)
} catch (err) {
console.error('Alert error', err)
} finally {
console.log('Alert finished')
}