@ajaxjs/ui 1.1.6 → 1.1.7

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.
@@ -1,4 +1,4 @@
1
- declare module '*.vue' {
2
- import Vue from 'vue'
3
- export default Vue
4
- }
1
+ declare module '*.vue' {
2
+ import Vue from 'vue'
3
+ export default Vue
4
+ }
@@ -6,7 +6,7 @@
6
6
  * @returns 配置内容(value)Promise
7
7
  */
8
8
  export declare function getConfig(key: string, defaultValue?: string): Promise<ConfigJson>;
9
- declare type ConfigJson = {
9
+ type ConfigJson = {
10
10
  code: number;
11
11
  data: any;
12
12
  };
@@ -2,7 +2,7 @@ import { XhrConfig } from './xhr-config';
2
2
  /**
3
3
  * 处理响应的回调函数
4
4
  */
5
- declare type XhrCallback = (json: {}, text: string) => void;
5
+ type XhrCallback = (json: {}, text: string) => void;
6
6
  /**
7
7
  * 设置全局请求的 head 参数
8
8
  *
@@ -1,140 +1,140 @@
1
- <template>
2
- <ul class="aj-accordion-menu" @click="onClk">
3
- <slot></slot>
4
- </ul>
5
- </template>
6
-
7
- <script lang="ts">
8
- /**
9
- * 内部子菜单的高亮
10
- *
11
- * @param ev
12
- */
13
- function highlightSubItem(ev: Event) {
14
- let li: Element,
15
- el: Element = ev.target as Element;
16
-
17
- if (el.tagName == "A" && el.getAttribute("target")) {
18
- li = el.parentNode as Element;
19
- li.querySelectorAll("li").forEach((_el: Element) => {
20
- if (_el == li) _el.classList.add("selected");
21
- else _el.classList.remove("selected");
22
- });
23
- }
24
- }
25
-
26
- export default {
27
- methods: {
28
- onClk(ev: Event): void {
29
- let children: HTMLCollection = this.$el.children;
30
- highlightSubItem(ev);
31
- let _btn: Element = ev.target as Element;
32
-
33
- if (
34
- _btn &&
35
- _btn.tagName == "H3" &&
36
- (_btn.parentNode as Element).tagName == "LI"
37
- ) {
38
- _btn = _btn.parentNode as Element;
39
-
40
- for (let btn: Element, i: number = 0, j = children.length; i < j; i++) {
41
- btn = children[i];
42
- let ul = btn.querySelector("ul");
43
-
44
- if (btn == _btn) {
45
- if (btn.className.indexOf("pressed") != -1) {
46
- btn.classList.remove("pressed"); // 再次点击,隐藏!
47
- if (ul) ul.style.height = "0px";
48
- } else {
49
- if (ul) ul.style.height = ul.scrollHeight + "px";
50
- btn.classList.add("pressed");
51
- }
52
- } else {
53
- btn.classList.remove("pressed");
54
- if (ul) ul.style.height = "0px";
55
- }
56
- }
57
- } else return;
58
- },
59
- },
60
- };
61
- </script>
62
-
63
- <style lang="less" scoped>
64
- @import "../style/common-functions.less";
65
-
66
- // 折叠菜单 Accordion Menu
67
- .aj-accordion {
68
- & > li h3 {
69
- cursor: pointer;
70
- }
71
-
72
- .pressed {
73
- & h3 {
74
- color: black;
75
- }
76
- }
77
-
78
- & > li > ul {
79
- .transition (height .5s cubic-bezier(0, 1, 0.5, 1));;
80
- overflow: hidden;
81
- }
82
-
83
- ul {
84
- height: 0;
85
- }
86
- }
87
-
88
- .aj-accordion-menu {
89
- .aj-accordion ();
90
- overflow: hidden;
91
-
92
- & > li {
93
- border-top: 1px solid white;
94
- border-bottom: 1px solid lightgray;
95
-
96
- &.pressed {
97
- border-top: 0;
98
- border-bottom: 1px solid lightgray;
99
- box-shadow: inset 0px 10px 15px -15px gray;
100
-
101
- h3 {
102
- font-weight: bold;
103
- }
104
- }
105
-
106
- ul {
107
- li {
108
- // list-style-type: disc;
109
- padding-left: 15%;
110
-
111
- a {
112
- width: 100%;
113
- display: block;
114
- }
115
-
116
- &.selected {
117
- a {
118
- color: black;
119
- font-weight: bold;
120
- }
121
- }
122
- }
123
- }
124
-
125
- h3,
126
- li {
127
- padding: 5px 0 5px 15px;
128
- letter-spacing: 2px;
129
- line-height: 20px;
130
- color: #939da8;
131
- font-size: 12px;
132
-
133
- &:hover,
134
- a:hover {
135
- color: black;
136
- }
137
- }
138
- }
139
- }
1
+ <template>
2
+ <ul class="aj-accordion-menu" @click="onClk">
3
+ <slot></slot>
4
+ </ul>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ /**
9
+ * 内部子菜单的高亮
10
+ *
11
+ * @param ev
12
+ */
13
+ function highlightSubItem(ev: Event) {
14
+ let li: Element,
15
+ el: Element = ev.target as Element;
16
+
17
+ if (el.tagName == "A" && el.getAttribute("target")) {
18
+ li = el.parentNode as Element;
19
+ li.querySelectorAll("li").forEach((_el: Element) => {
20
+ if (_el == li) _el.classList.add("selected");
21
+ else _el.classList.remove("selected");
22
+ });
23
+ }
24
+ }
25
+
26
+ export default {
27
+ methods: {
28
+ onClk(ev: Event): void {
29
+ let children: HTMLCollection = this.$el.children;
30
+ highlightSubItem(ev);
31
+ let _btn: Element = ev.target as Element;
32
+
33
+ if (
34
+ _btn &&
35
+ _btn.tagName == "H3" &&
36
+ (_btn.parentNode as Element).tagName == "LI"
37
+ ) {
38
+ _btn = _btn.parentNode as Element;
39
+
40
+ for (let btn: Element, i: number = 0, j = children.length; i < j; i++) {
41
+ btn = children[i];
42
+ let ul = btn.querySelector("ul");
43
+
44
+ if (btn == _btn) {
45
+ if (btn.className.indexOf("pressed") != -1) {
46
+ btn.classList.remove("pressed"); // 再次点击,隐藏!
47
+ if (ul) ul.style.height = "0px";
48
+ } else {
49
+ if (ul) ul.style.height = ul.scrollHeight + "px";
50
+ btn.classList.add("pressed");
51
+ }
52
+ } else {
53
+ btn.classList.remove("pressed");
54
+ if (ul) ul.style.height = "0px";
55
+ }
56
+ }
57
+ } else return;
58
+ },
59
+ },
60
+ };
61
+ </script>
62
+
63
+ <style lang="less" scoped>
64
+ @import "../style/common-functions.less";
65
+
66
+ // 折叠菜单 Accordion Menu
67
+ .aj-accordion {
68
+ & > li h3 {
69
+ cursor: pointer;
70
+ }
71
+
72
+ .pressed {
73
+ & h3 {
74
+ color: black;
75
+ }
76
+ }
77
+
78
+ & > li > ul {
79
+ .transition (height .5s cubic-bezier(0, 1, 0.5, 1));;
80
+ overflow: hidden;
81
+ }
82
+
83
+ ul {
84
+ height: 0;
85
+ }
86
+ }
87
+
88
+ .aj-accordion-menu {
89
+ .aj-accordion ();
90
+ overflow: hidden;
91
+
92
+ & > li {
93
+ border-top: 1px solid white;
94
+ border-bottom: 1px solid lightgray;
95
+
96
+ &.pressed {
97
+ border-top: 0;
98
+ border-bottom: 1px solid lightgray;
99
+ box-shadow: inset 0px 10px 15px -15px gray;
100
+
101
+ h3 {
102
+ font-weight: bold;
103
+ }
104
+ }
105
+
106
+ ul {
107
+ li {
108
+ // list-style-type: disc;
109
+ padding-left: 15%;
110
+
111
+ a {
112
+ width: 100%;
113
+ display: block;
114
+ }
115
+
116
+ &.selected {
117
+ a {
118
+ color: black;
119
+ font-weight: bold;
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ h3,
126
+ li {
127
+ padding: 5px 0 5px 15px;
128
+ letter-spacing: 2px;
129
+ line-height: 20px;
130
+ color: #939da8;
131
+ font-size: 12px;
132
+
133
+ &:hover,
134
+ a:hover {
135
+ color: black;
136
+ }
137
+ }
138
+ }
139
+ }
140
140
  </style>
@@ -1,66 +1,65 @@
1
- <template>
2
- <div class="aj-adjust-font-size">
3
- <span>字体大小</span>
4
- <ul @click="onClk">
5
- <li><label><input type="radio" name="fontSize" /> 小</label></li>
6
- <li><label><input type="radio" name="fontSize" /> 中</label></li>
7
- <li><label><input type="radio" name="fontSize" /> 大</label></li>
8
- </ul>
9
- </div>
10
- </template>
11
-
12
- <script lang="ts">
13
- /**
14
- * 调整正文字体大小
15
- */
16
- export default {
17
- props: {
18
- articleTarget: { type: String, default: "article p" }, // 正文所在的位置,通过 CSS Selector 定位
19
- },
20
- methods: {
21
- onClk(ev: Event): void {
22
- let el: Element = ev.target as Element;
23
- let setFontSize = (fontSize: string): void => {
24
- document.body
25
- .querySelectorAll(this.$props.articleTarget)
26
- .forEach((p: HTMLParagraphElement) => (p.style.fontSize = fontSize));
27
- };
28
-
29
- if (el.tagName == "LABEL" || el.tagName == "INPUT") {
30
- if (el.tagName != "LABEL") el = el.parentNode as Element;
31
-
32
- console.log(el);
33
- if (el.innerHTML.indexOf("") != -1) setFontSize("12pt");
34
- else if (el.innerHTML.indexOf("") != -1) setFontSize("10.5pt");
35
- else if (el.innerHTML.indexOf("小") != -1) setFontSize("9pt");
36
- }
37
- },
38
- },
39
- };
40
- </script>
41
-
42
- <style lang="less" scoped>
43
- .aj-adjust-font-size {
44
- width: 210px;
45
- font-size: 0.8rem;
46
- padding: 2px 0;
47
-
48
- span {
49
- float: left;
50
- width: 35%;
51
- display: block;
52
- }
53
-
54
- ul {
55
- width: 65%;
56
- float: right;
57
- cursor: pointer;
58
-
59
- li {
60
- display: block;
61
- float: right;
62
- width: 33%;
63
- }
64
- }
65
- }
1
+ <template>
2
+ <div class="aj-adjust-font-size">
3
+ <span>字体大小</span>
4
+ <ul @click="onClk">
5
+ <li><label><input type="radio" name="fontSize" /> 小</label></li>
6
+ <li><label><input type="radio" name="fontSize" /> 中</label></li>
7
+ <li><label><input type="radio" name="fontSize" /> 大</label></li>
8
+ </ul>
9
+ </div>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ /**
14
+ * 调整正文字体大小
15
+ */
16
+ export default {
17
+ props: {
18
+ articleTarget: { type: String, default: "article p" }, // 正文所在的位置,通过 CSS Selector 定位
19
+ },
20
+ methods: {
21
+ onClk(ev: Event): void {
22
+ let el: Element = ev.target as Element;
23
+ let setFontSize = (fontSize: string): void => {
24
+ document.body
25
+ .querySelectorAll(this.$props.articleTarget)
26
+ .forEach((p: HTMLParagraphElement) => (p.style.fontSize = fontSize));
27
+ };
28
+
29
+ if (el.tagName == "LABEL" || el.tagName == "INPUT") {
30
+ if (el.tagName != "LABEL") el = el.parentNode as Element;
31
+
32
+ if (el.innerHTML.indexOf("大") != -1) setFontSize("12pt");
33
+ else if (el.innerHTML.indexOf("") != -1) setFontSize("10.5pt");
34
+ else if (el.innerHTML.indexOf("") != -1) setFontSize("9pt");
35
+ }
36
+ },
37
+ },
38
+ };
39
+ </script>
40
+
41
+ <style lang="less" scoped>
42
+ .aj-adjust-font-size {
43
+ width: 210px;
44
+ font-size: 0.8rem;
45
+ padding: 2px 0;
46
+
47
+ span {
48
+ float: left;
49
+ width: 35%;
50
+ display: block;
51
+ }
52
+
53
+ ul {
54
+ width: 65%;
55
+ float: right;
56
+ cursor: pointer;
57
+
58
+ li {
59
+ display: block;
60
+ float: right;
61
+ width: 33%;
62
+ }
63
+ }
64
+ }
66
65
  </style>
@@ -1,59 +1,59 @@
1
- <template>
2
- <article>
3
- <h2>{{title}}</h2>
4
-
5
- <div class="toolbar">
6
- <span v-if="author">作者: {{author}}</span> &nbsp;
7
- <a :href="source" v-if="source" target="_blank">
8
-
9
- <svg width="16px" height="16px" viewBox="0 0 24 24" style="cursor:pointer;vertical-align: middle;">
10
- <g stroke-width="2.1" stroke="#666" fill="none" stroke-linecap="round" stroke-linejoin="round">
11
- <polyline points="17 13.5 17 19.5 5 19.5 5 7.5 11 7.5"></polyline>
12
- <path d="M14,4.5 L20,4.5 L20,10.5 M20,4.5 L11,13.5"></path>
13
- </g>
14
- </svg>
15
- 来源</a>
16
- <FontSize style="float:right;clear:both"></FontSize>
17
- </div>
18
- <slot></slot>
19
- </article>
20
- </template>
21
-
22
- <script>
23
- import FontSize from './AdjustFontSize.vue';
24
-
25
- export default {
26
- props: {
27
- title: String, author: String, source: String
28
- },
29
- components: { FontSize }
30
- }
31
- </script>
32
-
33
- <style lang="less" scoped>
34
- @import "../style/common-functions.less";
35
-
36
- article {
37
- & > p {
38
- .aj-text-function();
39
- text-indent: 2em;
40
- }
41
- & > img,
42
- & > p > img {
43
- max-width: 80%;
44
- margin: 0 auto;
45
- display: block;
46
- }
47
-
48
- h2 {
49
- .aj-text-title();
50
- }
51
-
52
- .toolbar {
53
- height: 15px;
54
- margin: 30px 0;
55
- font-size: 0.8rem;
56
- text-align: right;
57
- }
58
- }
1
+ <template>
2
+ <article>
3
+ <h2>{{title}}</h2>
4
+
5
+ <div class="toolbar">
6
+ <span v-if="author">作者: {{author}}</span> &nbsp;
7
+ <a :href="source" v-if="source" target="_blank">
8
+
9
+ <svg width="16px" height="16px" viewBox="0 0 24 24" style="cursor:pointer;vertical-align: middle;">
10
+ <g stroke-width="2.1" stroke="#666" fill="none" stroke-linecap="round" stroke-linejoin="round">
11
+ <polyline points="17 13.5 17 19.5 5 19.5 5 7.5 11 7.5"></polyline>
12
+ <path d="M14,4.5 L20,4.5 L20,10.5 M20,4.5 L11,13.5"></path>
13
+ </g>
14
+ </svg>
15
+ 来源</a>
16
+ <FontSize style="float:right;clear:both"></FontSize>
17
+ </div>
18
+ <slot></slot>
19
+ </article>
20
+ </template>
21
+
22
+ <script>
23
+ import FontSize from './AdjustFontSize.vue';
24
+
25
+ export default {
26
+ props: {
27
+ title: String, author: String, source: String
28
+ },
29
+ components: { FontSize }
30
+ }
31
+ </script>
32
+
33
+ <style lang="less" scoped>
34
+ @import "../style/common-functions.less";
35
+
36
+ article {
37
+ & > p {
38
+ .aj-text-function();
39
+ text-indent: 2em;
40
+ }
41
+ & > img,
42
+ & > p > img {
43
+ max-width: 80%;
44
+ margin: 0 auto;
45
+ display: block;
46
+ }
47
+
48
+ h2 {
49
+ .aj-text-title();
50
+ }
51
+
52
+ .toolbar {
53
+ height: 15px;
54
+ margin: 30px 0;
55
+ font-size: 0.8rem;
56
+ text-align: right;
57
+ }
58
+ }
59
59
  </style>
@@ -1,50 +1,50 @@
1
- <template>
2
- <form class="aj-widget-baidu-search" method="GET" action="http://www.baidu.com/baidu" onsubmit="//return g(this);">
3
- <input type="text" name="word" placeholder="请输入搜索之关键字" />
4
- <input name="tn" value="bds" type="hidden" />
5
- <input name="cl" value="3" type="hidden" />
6
- <input name="ct" value="2097152" type="hidden" />
7
- <input name="si" :value="getSiteDomainName" type="hidden" />
8
- <div class="searchBtn" onclick="this.parentNode.submit();"></div>
9
- </form>
10
- </template>
11
-
12
- <script lang="ts">
13
- /**
14
- * Baidu 自定义搜索
15
- */
16
- export default {
17
- props: {
18
- siteDomainName: String,
19
- },
20
- computed: {
21
- getSiteDomainName(): string {
22
- return this.siteDomainName || location.host || document.domain;
23
- },
24
- },
25
- };
26
- </script>
27
-
28
- <style lang="less" scoped>
29
- .aj-widget-baidu-search {
30
- padding: 0;
31
- margin: 0;
32
-
33
- input[type="text"] {
34
- border-radius: 5px;
35
- border: 1px solid gray;
36
- padding: 0 2px;
37
- height: 22px;
38
- }
39
-
40
- .searchBtn {
41
- background: url("data:image/gif;base64,R0lGODlhEAAQAGYAACH5BAEAAAAALAAAAAAQABAApgEAAOD3//n9/+3//936/xt7uX+x1KAQCyeHwsj1/6QcGZDd+fX+/+oOAFW05FCUxMXs+9P0/+T0+7fv/5rm/6fn/bHr/jCBugt0t0CKv47e+4fW9CaEv6fb8w9/weteSfkEAOsJC8xBKehVP+FZPxF1thZ4uMHx/1FBZQdssQ51uLrk9zlumyB3tDBRir3x/7nm+WK75DKb0z2k2XTG6mXD7Gq/6Euq20yk1EWp20ay5Umv4liw3dUcAKowMBqJycEzB8EqANoZACOa2KQNCp4NCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeWgACCDwUIhgaCiYoFNBQWFQs4F4qJBQsRAZkBFTwZlBcbEQMCpAMDCwiUBRQEpCcTCQEwN4iJHBYSAgmwBAEQObWCBRoBAi8JvQMdMsEAGTEQAQTJAw4qlAAmNSsM3RIOPyzYACUzOjY7Qx4uIQfjDykYGC0oHyAN7uOKCiMNQvn6BCkg0SNIkYCJFIgAAhChDyII9QUCADs=")
42
- no-repeat center;
43
- width: 25px;
44
- height: 25px;
45
- cursor: pointer;
46
- display: inline-block;
47
- vertical-align: bottom;
48
- }
49
- }
1
+ <template>
2
+ <form class="aj-widget-baidu-search" method="GET" action="http://www.baidu.com/baidu" onsubmit="//return g(this);">
3
+ <input type="text" name="word" placeholder="请输入搜索之关键字" />
4
+ <input name="tn" value="bds" type="hidden" />
5
+ <input name="cl" value="3" type="hidden" />
6
+ <input name="ct" value="2097152" type="hidden" />
7
+ <input name="si" :value="getSiteDomainName" type="hidden" />
8
+ <div class="searchBtn" onclick="this.parentNode.submit();"></div>
9
+ </form>
10
+ </template>
11
+
12
+ <script lang="ts">
13
+ /**
14
+ * Baidu 自定义搜索
15
+ */
16
+ export default {
17
+ props: {
18
+ siteDomainName: String,
19
+ },
20
+ computed: {
21
+ getSiteDomainName(): string {
22
+ return this.siteDomainName || location.host || document.domain;
23
+ },
24
+ },
25
+ };
26
+ </script>
27
+
28
+ <style lang="less" scoped>
29
+ .aj-widget-baidu-search {
30
+ padding: 0;
31
+ margin: 0;
32
+
33
+ input[type="text"] {
34
+ border-radius: 5px;
35
+ border: 1px solid gray;
36
+ padding: 0 2px;
37
+ height: 22px;
38
+ }
39
+
40
+ .searchBtn {
41
+ background: url("data:image/gif;base64,R0lGODlhEAAQAGYAACH5BAEAAAAALAAAAAAQABAApgEAAOD3//n9/+3//936/xt7uX+x1KAQCyeHwsj1/6QcGZDd+fX+/+oOAFW05FCUxMXs+9P0/+T0+7fv/5rm/6fn/bHr/jCBugt0t0CKv47e+4fW9CaEv6fb8w9/weteSfkEAOsJC8xBKehVP+FZPxF1thZ4uMHx/1FBZQdssQ51uLrk9zlumyB3tDBRir3x/7nm+WK75DKb0z2k2XTG6mXD7Gq/6Euq20yk1EWp20ay5Umv4liw3dUcAKowMBqJycEzB8EqANoZACOa2KQNCp4NCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeWgACCDwUIhgaCiYoFNBQWFQs4F4qJBQsRAZkBFTwZlBcbEQMCpAMDCwiUBRQEpCcTCQEwN4iJHBYSAgmwBAEQObWCBRoBAi8JvQMdMsEAGTEQAQTJAw4qlAAmNSsM3RIOPyzYACUzOjY7Qx4uIQfjDykYGC0oHyAN7uOKCiMNQvn6BCkg0SNIkYCJFIgAAhChDyII9QUCADs=")
42
+ no-repeat center;
43
+ width: 25px;
44
+ height: 25px;
45
+ cursor: pointer;
46
+ display: inline-block;
47
+ vertical-align: bottom;
48
+ }
49
+ }
50
50
  </style>