This repository was archived by the owner on Mar 17, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +96
-0
lines changed Expand file tree Collapse file tree 9 files changed +96
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,14 @@ module.exports = {
43
43
'components/textbox' ,
44
44
'components/toggle' ,
45
45
]
46
+ } ,
47
+ {
48
+ title : 'Directives' ,
49
+ collapsable : false ,
50
+ children : [
51
+ 'directives/autofocus' ,
52
+ 'directives/clickoutside'
53
+ ] ,
46
54
}
47
55
]
48
56
} ,
Original file line number Diff line number Diff line change
1
+ # Autofocus <badge text =" stable " />
2
+
3
+ The ` v-autofocus ` directive do auto focus when document is ready.
4
+
5
+ ## Example
6
+ <div class =" p-3 border rounded-2 my-3 flex " >
7
+ <input v-autofocus =" true " placeholder =" Auto focusable input " />
8
+ </div >
9
+
10
+
11
+ ``` html
12
+ <input v-autofocus =" true" placeholder =" Auto focusable input" />
13
+ ```
14
+
15
+ ## Arguments
16
+ Name | type | Description
17
+ -------- | -----------| -----
18
+ main | Boolean | Whether auto focus is enabled or not
19
+
Original file line number Diff line number Diff line change
1
+ # Clickoutside <badge text =" stable " />
2
+
3
+ The ` v-clickoutside ` directive allows to run callback on click out of element.
4
+
5
+ ## Example
6
+ <div class =" p-3 border rounded-2 my-3 flex " >
7
+ <v-button v-clickoutside =" handleClickoutside " appearance =" primary " >Click me or miss</v-button >
8
+ </div >
9
+
10
+
11
+ ``` html
12
+ <v-button
13
+ appearance =" primary"
14
+ v-clickoutside =" handleClickoutside"
15
+ >
16
+ Click me or miss
17
+ </v-button >
18
+ ```
19
+
20
+ ``` javascript
21
+ export default {
22
+ methods: {
23
+ handleClickoutside () {
24
+ alert (' You clicked outside the button!' );
25
+ },
26
+ },
27
+ };
28
+ ```
29
+
30
+ <script >
31
+ export default {
32
+ methods: {
33
+ handleClickoutside () {
34
+ alert (' You clicked outside the button!' );
35
+ },
36
+ },
37
+ };
38
+ </script >
39
+
40
+ ## Arguments
41
+ Name | type | Description
42
+ -------- | -----------| -----
43
+ main | Function | Callback that will be executed on clickoutside
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import Autofocus from './autofocus' ;
2
+
3
+ // eslint-disable-next-line func-names
4
+ Autofocus . install = function ( Vue ) {
5
+ Vue . directive ( 'Autofocus' , Autofocus ) ;
6
+ } ;
7
+
8
+ export default Autofocus ;
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import Clickoutside from './clickoutside' ;
2
+
3
+ // eslint-disable-next-line func-names
4
+ Clickoutside . install = function ( Vue ) {
5
+ Vue . directive ( 'Clickoutside' , Clickoutside ) ;
6
+ } ;
7
+
8
+ export default Clickoutside ;
Original file line number Diff line number Diff line change
1
+ export { default as Autofocus } from './autofocus' ;
2
+ export { default as Clickoutside } from './clickoutside' ;
Original file line number Diff line number Diff line change 1
1
// Import vue components
2
2
import * as components from './components' ;
3
+ import * as directives from './directives' ;
3
4
4
5
// install function executed by Vue.use()
5
6
function install ( Vue ) {
@@ -8,6 +9,9 @@ function install(Vue) {
8
9
Object . keys ( components ) . forEach ( ( component ) => {
9
10
Vue . component ( component , components [ component ] ) ;
10
11
} ) ;
12
+ Object . keys ( directives ) . forEach ( ( directive ) => {
13
+ Vue . directive ( directive , directives [ directive ] ) ;
14
+ } ) ;
11
15
}
12
16
13
17
// Create module definition for Vue.use()
@@ -33,3 +37,7 @@ export default plugin;
33
37
// To allow individual component use, export components
34
38
// each can be registered via Vue.component()
35
39
export * from './components' ;
40
+
41
+ // To allow individual directive use, export directives
42
+ // each can be registered via Vue.directive()
43
+ export * from './directives' ;
You can’t perform that action at this time.
0 commit comments