vdesign-ui 0.1.24 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
@@ -13,6 +13,10 @@
13
13
  width: 164px;
14
14
  height: 118px;
15
15
  margin: 0 auto;
16
+ img{
17
+ width: 100%;
18
+ height: 100%;
19
+ }
16
20
  }
17
21
 
18
22
 
@@ -1,81 +1,81 @@
1
- import Vue from 'vue';
2
- import { on } from './dom';
3
- // 定义一个空数组 nodeList,用于存储绑定了该指令的元素。
4
- const nodeList = [];
5
- //定义一个常量 ctx,用于标识特殊属性名。
6
- const ctx = '@@clickoutsideContext';
7
- // 定义一个变量 startClick,用于存储点击开始时的事件对象。
8
- let startClick;
9
- // 定义一个变量 seed,用作节点标识的种子。
10
- let seed = 0;
11
- // 在文档上添加一个 mousedown 事件监听器,用于记录点击开始时的事件对象。
12
- !Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e));
13
- // 添加一个 mouseup 事件监听器。当鼠标放开时,
14
- !Vue.prototype.$isServer && on(document, 'mouseup', e => {
15
- // 遍历 nodeList 数组中的每个元素,并执行它们的 documentHandler 函数。
16
- nodeList.forEach(node => node[ctx].documentHandler(e, startClick));
17
- });
18
- // 创建一个处理文档点击事件的函数。
19
- // 该函数返回一个闭包函数,用于检查点击事件是否发生在绑定的元素外部,并执行相应的回调函数。
20
- function createDocumentHandler(el, binding, vnode) {
21
- return function (mouseup = {}, mousedown = {}) {
22
- if (!vnode ||
23
- !vnode.context ||
24
- !mouseup.target ||
25
- !mousedown.target ||
26
- el.contains(mouseup.target) ||
27
- el.contains(mousedown.target) ||
28
- el === mouseup.target ||
29
- (vnode.context.popperElm &&
30
- (vnode.context.popperElm.contains(mouseup.target) ||
31
- vnode.context.popperElm.contains(mousedown.target)))) return;
32
-
33
- if (binding.expression &&
34
- el[ctx].methodName &&
35
- vnode.context[el[ctx].methodName]) {
36
- vnode.context[el[ctx].methodName]();
37
- } else {
38
- el[ctx].bindingFn && el[ctx].bindingFn();
39
- }
40
- };
41
- }
42
-
43
- /**
44
- * v-clickoutside
45
- * @desc 点击元素外面才会触发的事件
46
- * @example
47
- * ```vue
48
- * <div v-element-clickoutside="handleClose">
49
- * ```
50
- */
51
- export default {
52
- // 将元素添加到 nodeList 数组中,并为该元素添加一个包含事件处理函数的特殊属性。
53
- bind(el, binding, vnode) {
54
- nodeList.push(el);
55
- const id = seed++;
56
- el[ctx] = {
57
- id,
58
- documentHandler: createDocumentHandler(el, binding, vnode),
59
- methodName: binding.expression,
60
- bindingFn: binding.value
61
- };
62
- },
63
- // 当指令所在组件的 VNode 更新时调用,更新元素的事件处理函数和绑定方法。
64
- update(el, binding, vnode) {
65
- el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
66
- el[ctx].methodName = binding.expression;
67
- el[ctx].bindingFn = binding.value;
68
- },
69
- // 从 nodeList 中移除对应的元素,并删除特殊属性。
70
- unbind(el) {
71
- let len = nodeList.length;
72
-
73
- for (let i = 0; i < len; i++) {
74
- if (nodeList[i][ctx].id === el[ctx].id) {
75
- nodeList.splice(i, 1);
76
- break;
77
- }
78
- }
79
- delete el[ctx];
80
- }
81
- };
1
+ import Vue from 'vue';
2
+ import { on } from './dom';
3
+ // 定义一个空数组 nodeList,用于存储绑定了该指令的元素。
4
+ const nodeList = [];
5
+ //定义一个常量 ctx,用于标识特殊属性名。
6
+ const ctx = '@@clickoutsideContext';
7
+ // 定义一个变量 startClick,用于存储点击开始时的事件对象。
8
+ let startClick;
9
+ // 定义一个变量 seed,用作节点标识的种子。
10
+ let seed = 0;
11
+ // 在文档上添加一个 mousedown 事件监听器,用于记录点击开始时的事件对象。
12
+ !Vue.prototype.$isServer && on(document, 'mousedown', e => (startClick = e));
13
+ // 添加一个 mouseup 事件监听器。当鼠标放开时,
14
+ !Vue.prototype.$isServer && on(document, 'mouseup', e => {
15
+ // 遍历 nodeList 数组中的每个元素,并执行它们的 documentHandler 函数。
16
+ nodeList.forEach(node => node[ctx].documentHandler(e, startClick));
17
+ });
18
+ // 创建一个处理文档点击事件的函数。
19
+ // 该函数返回一个闭包函数,用于检查点击事件是否发生在绑定的元素外部,并执行相应的回调函数。
20
+ function createDocumentHandler(el, binding, vnode) {
21
+ return function (mouseup = {}, mousedown = {}) {
22
+ if (!vnode ||
23
+ !vnode.context ||
24
+ !mouseup.target ||
25
+ !mousedown.target ||
26
+ el.contains(mouseup.target) ||
27
+ el.contains(mousedown.target) ||
28
+ el === mouseup.target ||
29
+ (vnode.context.popperElm &&
30
+ (vnode.context.popperElm.contains(mouseup.target) ||
31
+ vnode.context.popperElm.contains(mousedown.target)))) return;
32
+
33
+ if (binding.expression &&
34
+ el[ctx].methodName &&
35
+ vnode.context[el[ctx].methodName]) {
36
+ vnode.context[el[ctx].methodName]();
37
+ } else {
38
+ el[ctx].bindingFn && el[ctx].bindingFn();
39
+ }
40
+ };
41
+ }
42
+
43
+ /**
44
+ * v-clickoutside
45
+ * @desc 点击元素外面才会触发的事件
46
+ * @example
47
+ * ```vue
48
+ * <div v-element-clickoutside="handleClose">
49
+ * ```
50
+ */
51
+ export default {
52
+ // 将元素添加到 nodeList 数组中,并为该元素添加一个包含事件处理函数的特殊属性。
53
+ bind(el, binding, vnode) {
54
+ nodeList.push(el);
55
+ const id = seed++;
56
+ el[ctx] = {
57
+ id,
58
+ documentHandler: createDocumentHandler(el, binding, vnode),
59
+ methodName: binding.expression,
60
+ bindingFn: binding.value
61
+ };
62
+ },
63
+ // 当指令所在组件的 VNode 更新时调用,更新元素的事件处理函数和绑定方法。
64
+ update(el, binding, vnode) {
65
+ el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
66
+ el[ctx].methodName = binding.expression;
67
+ el[ctx].bindingFn = binding.value;
68
+ },
69
+ // 从 nodeList 中移除对应的元素,并删除特殊属性。
70
+ unbind(el) {
71
+ let len = nodeList.length;
72
+
73
+ for (let i = 0; i < len; i++) {
74
+ if (nodeList[i][ctx].id === el[ctx].id) {
75
+ nodeList.splice(i, 1);
76
+ break;
77
+ }
78
+ }
79
+ delete el[ctx];
80
+ }
81
+ };
@@ -1,41 +1,41 @@
1
- /* istanbul ignore next */
2
-
3
- import Vue from 'vue';
4
-
5
- const isServer = Vue.prototype.$isServer;
6
- /* istanbul ignore next */
7
- export const on = (function () {
8
- // 添加事件监听器
9
- if (!isServer && document.addEventListener) {
10
- return function (element, event, handler) {
11
- if (element && event && handler) {
12
- element.addEventListener(event, handler, false);
13
- }
14
- };
15
- } else {
16
- // IE8 及其以下版本没有 addEventListener 方法
17
- return function (element, event, handler) {
18
- if (element && event && handler) {
19
- element.attachEvent('on' + event, handler);
20
- }
21
- };
22
- }
23
- })();
24
-
25
- /* istanbul ignore next */
26
- export const off = (function () {
27
- // 移除事件监听器
28
- if (!isServer && document.removeEventListener) {
29
- return function (element, event, handler) {
30
- if (element && event) {
31
- element.removeEventListener(event, handler, false);
32
- }
33
- };
34
- } else {
35
- return function (element, event, handler) {
36
- if (element && event) {
37
- element.detachEvent('on' + event, handler);
38
- }
39
- };
40
- }
41
- })();
1
+ /* istanbul ignore next */
2
+
3
+ import Vue from 'vue';
4
+
5
+ const isServer = Vue.prototype.$isServer;
6
+ /* istanbul ignore next */
7
+ export const on = (function () {
8
+ // 添加事件监听器
9
+ if (!isServer && document.addEventListener) {
10
+ return function (element, event, handler) {
11
+ if (element && event && handler) {
12
+ element.addEventListener(event, handler, false);
13
+ }
14
+ };
15
+ } else {
16
+ // IE8 及其以下版本没有 addEventListener 方法
17
+ return function (element, event, handler) {
18
+ if (element && event && handler) {
19
+ element.attachEvent('on' + event, handler);
20
+ }
21
+ };
22
+ }
23
+ })();
24
+
25
+ /* istanbul ignore next */
26
+ export const off = (function () {
27
+ // 移除事件监听器
28
+ if (!isServer && document.removeEventListener) {
29
+ return function (element, event, handler) {
30
+ if (element && event) {
31
+ element.removeEventListener(event, handler, false);
32
+ }
33
+ };
34
+ } else {
35
+ return function (element, event, handler) {
36
+ if (element && event) {
37
+ element.detachEvent('on' + event, handler);
38
+ }
39
+ };
40
+ }
41
+ })();
@@ -1,40 +1,40 @@
1
- // outlineConfigPlugin.js
2
-
3
- // __debug=1&__debug_vdesign_token=1
4
- const OutlineConfig = {
5
- install(Vue, options = {}) {
6
- const outlineConfig = Vue.observable({
7
- outlineEnabled: options.outlineEnabled ||false,
8
- });
9
-
10
- Vue.prototype.$outlineConfig = outlineConfig;
11
-
12
- Vue.mixin({
13
- created() {
14
- this.$outlineConfig.outlineEnabled = this.shouldEnableOutline()
15
-
16
- this.$watch('$outlineConfig.outlineEnabled', (newValue) => {
17
- document.documentElement.style.setProperty('--outline-visible', newValue ? '1px' : '0');
18
- }, { immediate: true });
19
- },
20
- methods:{
21
- shouldEnableOutline() {
22
- // 获取URL的查询参数部分
23
- const searchParams = new URLSearchParams(window.location.search);
24
- // 对于哈希模式,也解析哈希中的查询字符串
25
- const hashParams = window.location.hash.split('?')[1] ? new URLSearchParams(window.location.hash.split('?')[1]) : null;
26
-
27
- // 检查查询参数或哈希中的参数
28
- const debug = searchParams.has('__debug') || (hashParams && hashParams.has('__debug')) ? searchParams.get('__debug') === '1' || (hashParams && hashParams.get('__debug') === '1') : false;
29
- const vdesignToken = searchParams.has('__debug_vdesign_token') || (hashParams && hashParams.has('__debug_vdesign_token')) ? searchParams.get('__debug_vdesign_token') === '1' || (hashParams && hashParams.get('__debug_vdesign_token') === '1') : false;
30
-
31
- return debug && vdesignToken;
32
- }
33
- }
34
- });
35
- }
36
- };
37
-
38
-
39
-
40
- export default OutlineConfig;
1
+ // outlineConfigPlugin.js
2
+
3
+ // __debug=1&__debug_vdesign_token=1
4
+ const OutlineConfig = {
5
+ install(Vue, options = {}) {
6
+ const outlineConfig = Vue.observable({
7
+ outlineEnabled: options.outlineEnabled ||false,
8
+ });
9
+
10
+ Vue.prototype.$outlineConfig = outlineConfig;
11
+
12
+ Vue.mixin({
13
+ created() {
14
+ this.$outlineConfig.outlineEnabled = this.shouldEnableOutline()
15
+
16
+ this.$watch('$outlineConfig.outlineEnabled', (newValue) => {
17
+ document.documentElement.style.setProperty('--outline-visible', newValue ? '1px' : '0');
18
+ }, { immediate: true });
19
+ },
20
+ methods:{
21
+ shouldEnableOutline() {
22
+ // 获取URL的查询参数部分
23
+ const searchParams = new URLSearchParams(window.location.search);
24
+ // 对于哈希模式,也解析哈希中的查询字符串
25
+ const hashParams = window.location.hash.split('?')[1] ? new URLSearchParams(window.location.hash.split('?')[1]) : null;
26
+
27
+ // 检查查询参数或哈希中的参数
28
+ const debug = searchParams.has('__debug') || (hashParams && hashParams.has('__debug')) ? searchParams.get('__debug') === '1' || (hashParams && hashParams.get('__debug') === '1') : false;
29
+ const vdesignToken = searchParams.has('__debug_vdesign_token') || (hashParams && hashParams.has('__debug_vdesign_token')) ? searchParams.get('__debug_vdesign_token') === '1' || (hashParams && hashParams.get('__debug_vdesign_token') === '1') : false;
30
+
31
+ return debug && vdesignToken;
32
+ }
33
+ }
34
+ });
35
+ }
36
+ };
37
+
38
+
39
+
40
+ export default OutlineConfig;
@@ -1,23 +1,23 @@
1
- /**
2
- * add Vue-Router support
3
- */
4
-
5
- export default {
6
- props: {
7
- url: String,
8
- replace: Boolean,
9
- to: [String, Object]
10
- },
11
-
12
- methods: {
13
- routerLink() {
14
- const { to, url, $router, replace } = this;
15
- if (to && $router) {
16
- $router[replace ? 'replace' : 'push'](to);
17
- } else if (url) {
18
- replace ? location.replace(url) : location.href = url;
19
- }
20
- }
21
- }
22
- };
1
+ /**
2
+ * add Vue-Router support
3
+ */
4
+
5
+ export default {
6
+ props: {
7
+ url: String,
8
+ replace: Boolean,
9
+ to: [String, Object]
10
+ },
11
+
12
+ methods: {
13
+ routerLink() {
14
+ const { to, url, $router, replace } = this;
15
+ if (to && $router) {
16
+ $router[replace ? 'replace' : 'push'](to);
17
+ } else if (url) {
18
+ replace ? location.replace(url) : location.href = url;
19
+ }
20
+ }
21
+ }
22
+ };
23
23