在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:sciactive/pnotify开源软件地址:https://github.com/sciactive/pnotify开源编程语言:HTML 48.3%开源软件介绍:A JavaScript/TypeScript notification, confirmation, and prompt library. Notifications can display as toast style, snackbar style, banners, dialogs, alerts, or desktop notifications (using the Web Notifications spec) with fall back to an in-browser notice. PNotify provides a unique notification flow called modalish that provides a good user experience, even when many notifications are shown at once. DemosLatest Stable - http://sciactive.com/pnotify/ Development - https://sciactive.github.io/pnotify/ Table of Contents
Getting StartedYou can get PNotify using NPM or Yarn. (You can also use jsDelivr.) You should install the packages you need individually. Alternatively, you can install all of them at once with the # Install the packages you need individually.
# You definitely need this one.
npm install --save-dev @pnotify/core
# These are the optional ones.
npm install --save-dev @pnotify/animate
npm install --save-dev @pnotify/bootstrap3
npm install --save-dev @pnotify/bootstrap4
npm install --save-dev @pnotify/confirm
npm install --save-dev @pnotify/countdown
npm install --save-dev @pnotify/desktop
npm install --save-dev @pnotify/font-awesome4
npm install --save-dev @pnotify/font-awesome5-fix
npm install --save-dev @pnotify/font-awesome5
npm install --save-dev @pnotify/glyphicon
npm install --save-dev @pnotify/mobile
npm install --save-dev @pnotify/paginate
# ...
# Or, you can install this to get them all.
npm install --save-dev pnotify Documentation for Old Versions
Migrating from PNotify 4InstallationIn addition to the JS and CSS, be sure to include a PNotify style. Svelteimport { alert, defaultModules } from '@pnotify/core';
import * as PNotifyMobile from '@pnotify/mobile';
defaultModules.set(PNotifyMobile, {});
alert({
text: 'Notice me, senpai!'
}); Reactimport { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';
defaultModules.set(PNotifyMobile, {});
alert({
text: 'Notice me, senpai!'
}); Angularimport { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';
defaultModules.set(PNotifyMobile, {});
//...
export class WhateverComponent {
constructor() {
alert({
text: 'Notice me, senpai!'
});
}
} For IE support, see this issue. Angular (Injectable)PNotify in Angular (Injectable) // pnotify.service.ts
import { Injectable } from '@angular/core';
import { alert, defaultModules } from '@pnotify/core';
import '@pnotify/core/dist/PNotify.css';
import * as PNotifyMobile from '@pnotify/mobile';
import '@pnotify/mobile/dist/PNotifyMobile.css';
defaultModules.set(PNotifyMobile, {});
@Injectable()
export class PNotifyService {
getPNotifyAlert() {
return alert;
}
}
// whatever.module.ts
//...
import { PNotifyService } from './pnotify.service';
@NgModule({
declarations: [...],
imports: [...],
providers: [PNotifyService],
bootstrap: [...]
})
export class WhateverModule {}
// whatever.component.ts
import { PNotifyService } from './pnotify.service';
//...
export class WhateverComponent {
alert = undefined;
constructor(pnotifyService: PNotifyService) {
this.alert = pnotifyService.getPNotifyAlert();
this.alert({
text: 'Notice me, senpai!'
});
}
} AngularJS<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" /> var angular = require('angular');
var PNotify = require('@pnotify/core');
var PNotifyMobile = require('@pnotify/mobile');
PNotify.defaultModules.set(PNotifyMobile, {});
angular.module('WhateverModule', [])
.value('PNotify', PNotify)
.controller('WhateverController', ['PNotify', function(PNotify) {
PNotify.alert({
text: 'Notice me, senpai!'
});
}]); Vanilla JS (ES5)PNotify in vanilla ES5 <script type="text/javascript" src="node_modules/@pnotify/core/dist/PNotify.js"></script>
<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="node_modules/@pnotify/mobile/dist/PNotifyMobile.js"></script>
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
PNotify.defaultModules.set(PNotifyMobile, {});
PNotify.alert({
text: 'Notice me, senpai!'
});
</script> Vanilla JS (ES6)<link href="node_modules/@pnotify/core/dist/PNotify.css" rel="stylesheet" type="text/css" />
<link href="node_modules/@pnotify/mobile/dist/PNotifyMobile.css" rel="stylesheet" type="text/css" />
<script type="module">
import { alert, defaultModules } from 'node_modules/@pnotify/core/dist/PNotify.js';
import * as PNotifyMobile from 'node_modules/@pnotify/mobile/dist/PNotifyMobile.js';
defaultModules.set(PNotifyMobile, {});
alert({
text: 'Notice me, senpai!'
});
</script> StylesBright ThemeThe default theme, Bright Theme. Supports dark mode. Include the CSS file in your page: <link href="node_modules/@pnotify/core/dist/BrightTheme.css" rel="stylesheet" type="text/css" /> Or if you're using a packager that imports CSS: import '@pnotify/core/dist/BrightTheme.css'; MaterialThe Material theme. Supports dark mode. Requires material-design-icons and optionally the Roboto font. Include the CSS file in your page: <link href="node_modules/@pnotify/core/dist/Material.css" rel="stylesheet" type="text/css" /> Or if you're using a packager that imports CSS: import '@pnotify/core/dist/Material.css'; Then set the default styling and icons to 'material': import { defaults } from '@pnotify/core';
// or
const { defaults } = require('@pnotify/core');
// Set default styling.
defaults.styling = 'material';
// This icon setting requires the Material Icons font. (See below.)
defaults.icons = 'material'; Material IconsTo use the Material Style icons, include the Material Design Icons Font in your page. # The official Google package:
npm install --save material-design-icons
# OR, An unofficial package that only includes the font:
npm install --save material-design-icon-fonts <link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css" /> Or if you're using a packager that imports CSS: import 'material-design-icons/iconfont/material-icons.css'; Alternatively, you can use the Google Fonts CDN: <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" /> Or a clone from jsDelivr: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/material-icons-font.css" /> Roboto FontThe Material style uses the "400" and "500" weights of Roboto. It will fall back to "sans-serif". You can use the Google Font CDN: <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" /> AngelerThe Angeler theme. Supports dark mode. Include the CSS file in your page: <link href="node_modules/@pnotify/core/dist/Angeler.css" rel="stylesheet" type="text/css" /> Or if you're using a packager that imports CSS: import '@pnotify/core/dist/Angeler.css'; It's recommended that you set the close button to not hide by default, as that is how Angela designed the theme to look best. import { defaults } from '@pnotify/core';
// or
const { defaults } = require('@pnotify/core');
defaults.closerHover = false; You can use the alert({
text: "I'll be more expanded than normal, with a separated title line.",
addClass: 'angeler-extended'
});
Bootstrapnpm install --save-dev @pnotify/bootstrap3 @pnotify/glyphicon
# or
npm install --save-dev @pnotify/bootstrap4 Styling for the popular Bootstrap library. Doesn't support dark mode (but you can use a Bootstrap theme). Include the CSS: <link rel="stylesheet" href="node_modules/@pnotify/bootstrap4/dist/PNotifyBootstrap4.css" /> Or if you're using a packager that imports CSS: import '@pnotify/bootstrap4/dist/PNotifyBootstrap4.css'; Include the appropriate line(s) from below: import { defaultModules } from '@pnotify/core';
import * as PNotifyBootstrap4 from '@pnotify/bootstrap4';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyBootstrap4 = require('@pnotify/bootstrap4'); Then set it as a default module: defaultModules.set(PNotifyBootstrap4, {}); Change the "4" to "3" for Bootstrap 3, and also import and set Font Awesome 4 (Icons)npm install --save-dev @pnotify/font-awesome4 To set Font Awesome 4 as the default icons, include the appropriate line from below: import { defaultModules } from '@pnotify/core';
import * as PNotifyFontAwesome4 from '@pnotify/font-awesome4';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyFontAwesome4 = require('@pnotify/font-awesome4'); Then set it as a default module: defaultModules.set(PNotifyFontAwesome4, {}); Font Awesome 5 (Icons)npm install --save-dev @pnotify/font-awesome5 @pnotify/font-awesome5-fix To set Font Awesome 5 as the default icons, include the appropriate line from below: import { defaultModules } from '@pnotify/core';
import * as PNotifyFontAwesome5Fix from '@pnotify/font-awesome5-fix';
import * as PNotifyFontAwesome5 from '@pnotify/font-awesome5';
// or
const { defaultModules } = require('@pnotify/core');
const PNotifyFontAwesome5F |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论