《开源精选》是我们分享Github、Gitee等开源社区中优质项目的栏目,包括技术、学习、实用与各种有趣的内容。本期推荐的是一个强大的跨iOS、Android 和Web平台的UI工具包——Ionic。
Ionic 是一个开源应用程序开发工具包,用于使用 JavaScript 和 Web 从单个代码库构建现代、快速、高质量的跨平台原生和渐进式 Web 应用程序。
Ionic 基于Web 组件,可显着提高性能、可用性和功能,同时支持Angular、React和Vue等流行的 Web 框架。
使用npm:
npm install -g @ionic/cli
启动应用程序:
ionic start
运行应用:
cd myAppionic serve
卡片 Card:
Card Subtitle Card Title Here’s a small text description for the card component. Nothing more, nothing less.
Action
按钮 Button:
Default Anchor Primary Secondary Tertiary Success Warning Danger Light Medium Dark
列表 List:
Discover
Music we think you'll love.
{albums.map(album =>
{album.title}
{album.artist}, {album.year}
)}
生物识别 Identity vault:
logout() { // lock the vault when the user logs out this.identityVault.lock();}onVaultReady() { // unlock the vault using biometrics this.identityVault.unlock();}onVaultUnlocked() { // restore the session when the vault is unlocked this.session = await this.identityVault.restoreSession();}
相机 Camera:
async takeProfilePicture() { // Take a picture or video, or load from the library const picture = await this.camera.getPicture({ encodingType: this.camera.EncodingType.JPEG }); // confirm that users choice of picture const msg = "Set as new profile picture?"; const confirmed = await this.dialogs.confirm(msg); if (confirmed) { // upload the picture to the server return this.userService.uploadProfilePic(picture); }}
定位 Geoloaction:
async plotCurrentLocation() { // get the users current position const position = await this.geolocation.getCurrentPosition(); // grab latitude & longitude const latitude = position.coords.latitude; const longitude = position.coords.longitude; // place a pin on map at users current coordinates this.mapService.dropPin(latitude, longitude);}
—END—
开源协议:MIT
开源地址:https://github.com/ionic-team/ionic-framework
留言与评论(共有 0 条评论) “” |