-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
31 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Directive,DirectiveBinding } from 'vue' | ||
|
||
const btnAuthList = ['btnAuth1', 'btnAuth2', 'btnAuth3'] | ||
const auth: Directive = { | ||
mounted(el:HTMLElement, binding:DirectiveBinding) { | ||
const { value } = binding; | ||
if(Array.isArray(value) && value.length) { | ||
value.forEach(item => btnAuthList.includes(item) || el.remove()) | ||
} else { | ||
btnAuthList.includes(value) || el.remove(); | ||
} | ||
} | ||
} | ||
|
||
export default auth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import type { Directive,DirectiveBinding } from 'vue' | ||
|
||
import type { Directive,DirectiveBinding } from 'vue' | ||
const height:Directive = { | ||
mounted(el:HTMLElement, binding:DirectiveBinding, vnode, preVnode) { | ||
console.log('123'); | ||
console.log(binding, 'binding11111111'); | ||
|
||
el.style.height = binding.value + 'px' | ||
el.style.width = binding.value + 'px' | ||
el.innerText = binding.value + 'px' | ||
el.style.border = 'dashed red' | ||
mounted(el:HTMLElement, binding:DirectiveBinding, vnode, preVnode) { | ||
el.style.width = binding.value + 'px' | ||
el.innerText = binding.value + 'px' | ||
el.style.height = binding.value + 'px' | ||
el.style.border = 'dashed red' | ||
} | ||
} | ||
|
||
export default height; | ||
export default height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
import type { Directive,DirectiveBinding } from 'vue' | ||
|
||
const myText:Directive = { | ||
mounted(el:HTMLElement, binding:DirectiveBinding, vnode, preVnode) { | ||
console.log(binding, 'binding'); | ||
// console.log(vnode, 'vnode'); | ||
// console.log(preVnode, 'preVnode'); | ||
|
||
mounted(el:HTMLElement, binding:DirectiveBinding) { | ||
// el.style.height = binding.value + 'px' | ||
// el.innerText = binding.value + 'px' | ||
el.innerText = binding.value ? binding.value.name.split('').reverse().join('') : '无法识别'; | ||
} | ||
el.innerText = binding.value ? binding.value.name.split('').reverse().join('') : '无法识别'; | ||
} | ||
} | ||
|
||
export default myText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ import directives from '@/directive/index' | |
|
||
|
||
const app = createApp(App) | ||
|
||
// 注册全局指令 | ||
app.use(directives) | ||
|
||
|