first
This commit is contained in:
45
node_modules/vant/es/notify/Notify.js
generated
vendored
Normal file
45
node_modules/vant/es/notify/Notify.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { inherit } from '../utils/functional'; // Mixins
|
||||
|
||||
import { popupMixinProps } from '../mixins/popup'; // Components
|
||||
|
||||
import Popup from '../popup'; // Types
|
||||
|
||||
var _createNamespace = createNamespace('notify'),
|
||||
createComponent = _createNamespace[0],
|
||||
bem = _createNamespace[1];
|
||||
|
||||
function Notify(h, props, slots, ctx) {
|
||||
var style = {
|
||||
color: props.color,
|
||||
background: props.background
|
||||
};
|
||||
return h(Popup, _mergeJSXProps([{
|
||||
"attrs": {
|
||||
"value": props.value,
|
||||
"position": "top",
|
||||
"overlay": false,
|
||||
"duration": 0.2,
|
||||
"lockScroll": false
|
||||
},
|
||||
"style": style,
|
||||
"class": [bem([props.type]), props.className]
|
||||
}, inherit(ctx, true)]), [(slots.default == null ? void 0 : slots.default()) || props.message]);
|
||||
}
|
||||
|
||||
Notify.props = _extends({}, popupMixinProps, {
|
||||
color: String,
|
||||
message: [Number, String],
|
||||
duration: [Number, String],
|
||||
className: null,
|
||||
background: String,
|
||||
getContainer: [String, Function],
|
||||
type: {
|
||||
type: String,
|
||||
default: 'danger'
|
||||
}
|
||||
});
|
||||
export default createComponent(Notify);
|
1
node_modules/vant/es/notify/index.css
generated
vendored
Normal file
1
node_modules/vant/es/notify/index.css
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-notify{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:8px 16px;color:#fff;font-size:14px;line-height:20px;white-space:pre-wrap;text-align:center;word-wrap:break-word}.van-notify--primary{background-color:#1989fa}.van-notify--success{background-color:#07c160}.van-notify--danger{background-color:#ee0a24}.van-notify--warning{background-color:#ff976a}
|
93
node_modules/vant/es/notify/index.js
generated
vendored
Normal file
93
node_modules/vant/es/notify/index.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import Vue from 'vue';
|
||||
import VanNotify from './Notify';
|
||||
import { isObject, isServer } from '../utils';
|
||||
import { mount } from '../utils/functional';
|
||||
var timer;
|
||||
var instance;
|
||||
|
||||
function parseOptions(message) {
|
||||
return isObject(message) ? message : {
|
||||
message: message
|
||||
};
|
||||
}
|
||||
|
||||
function Notify(options) {
|
||||
/* istanbul ignore if */
|
||||
if (isServer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!instance) {
|
||||
instance = mount(VanNotify, {
|
||||
on: {
|
||||
click: function click(event) {
|
||||
if (instance.onClick) {
|
||||
instance.onClick(event);
|
||||
}
|
||||
},
|
||||
close: function close() {
|
||||
if (instance.onClose) {
|
||||
instance.onClose();
|
||||
}
|
||||
},
|
||||
opened: function opened() {
|
||||
if (instance.onOpened) {
|
||||
instance.onOpened();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
options = _extends({}, Notify.currentOptions, parseOptions(options));
|
||||
|
||||
_extends(instance, options);
|
||||
|
||||
clearTimeout(timer);
|
||||
|
||||
if (options.duration && options.duration > 0) {
|
||||
timer = setTimeout(Notify.clear, options.duration);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
function defaultOptions() {
|
||||
return {
|
||||
type: 'danger',
|
||||
value: true,
|
||||
message: '',
|
||||
color: undefined,
|
||||
background: undefined,
|
||||
duration: 3000,
|
||||
className: '',
|
||||
onClose: null,
|
||||
onClick: null,
|
||||
onOpened: null
|
||||
};
|
||||
}
|
||||
|
||||
Notify.clear = function () {
|
||||
if (instance) {
|
||||
instance.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
Notify.currentOptions = defaultOptions();
|
||||
|
||||
Notify.setDefaultOptions = function (options) {
|
||||
_extends(Notify.currentOptions, options);
|
||||
};
|
||||
|
||||
Notify.resetDefaultOptions = function () {
|
||||
Notify.currentOptions = defaultOptions();
|
||||
};
|
||||
|
||||
Notify.install = function () {
|
||||
Vue.use(VanNotify);
|
||||
};
|
||||
|
||||
Notify.Component = VanNotify;
|
||||
Vue.prototype.$notify = Notify;
|
||||
export default Notify;
|
33
node_modules/vant/es/notify/index.less
generated
vendored
Normal file
33
node_modules/vant/es/notify/index.less
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-notify {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
padding: @notify-padding;
|
||||
color: @notify-text-color;
|
||||
font-size: @notify-font-size;
|
||||
line-height: @notify-line-height;
|
||||
|
||||
// allow newline charactor
|
||||
white-space: pre-wrap;
|
||||
text-align: center;
|
||||
word-wrap: break-word;
|
||||
|
||||
&--primary {
|
||||
background-color: @notify-primary-background-color;
|
||||
}
|
||||
|
||||
&--success {
|
||||
background-color: @notify-success-background-color;
|
||||
}
|
||||
|
||||
&--danger {
|
||||
background-color: @notify-danger-background-color;
|
||||
}
|
||||
|
||||
&--warning {
|
||||
background-color: @notify-warning-background-color;
|
||||
}
|
||||
}
|
6
node_modules/vant/es/notify/style/index.js
generated
vendored
Normal file
6
node_modules/vant/es/notify/style/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import '../../style/base.css';
|
||||
import '../../overlay/index.css';
|
||||
import '../../info/index.css';
|
||||
import '../../icon/index.css';
|
||||
import '../../popup/index.css';
|
||||
import '../index.css';
|
6
node_modules/vant/es/notify/style/less.js
generated
vendored
Normal file
6
node_modules/vant/es/notify/style/less.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import '../../style/base.less';
|
||||
import '../../overlay/index.less';
|
||||
import '../../info/index.less';
|
||||
import '../../icon/index.less';
|
||||
import '../../popup/index.less';
|
||||
import '../index.less';
|
Reference in New Issue
Block a user