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 = {
4343 'components/textbox' ,
4444 'components/toggle' ,
4545 ]
46+ } ,
47+ {
48+ title : 'Directives' ,
49+ collapsable : false ,
50+ children : [
51+ 'directives/autofocus' ,
52+ 'directives/clickoutside'
53+ ] ,
4654 }
4755 ]
4856 } ,
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 11// Import vue components
22import * as components from './components' ;
3+ import * as directives from './directives' ;
34
45// install function executed by Vue.use()
56function install ( Vue ) {
@@ -8,6 +9,9 @@ function install(Vue) {
89 Object . keys ( components ) . forEach ( ( component ) => {
910 Vue . component ( component , components [ component ] ) ;
1011 } ) ;
12+ Object . keys ( directives ) . forEach ( ( directive ) => {
13+ Vue . directive ( directive , directives [ directive ] ) ;
14+ } ) ;
1115}
1216
1317// Create module definition for Vue.use()
@@ -33,3 +37,7 @@ export default plugin;
3337// To allow individual component use, export components
3438// each can be registered via Vue.component()
3539export * 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