-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1054 from solliancenet/jdh-doc-and-ui
UI and docs updates
- Loading branch information
Showing
5 changed files
with
66 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { nextTick } from 'vue'; | ||
|
||
const createChipOnBlur = { | ||
mounted(el, binding) { | ||
nextTick(() => { | ||
const input = el.querySelector('input'); | ||
if (input) { | ||
input.addEventListener('blur', () => { | ||
const value = input.value.trim(); | ||
|
||
if (value) { | ||
const propertyName = binding.arg; // Use the argument passed to the directive | ||
if (propertyName) { | ||
const targetArray = binding.instance[propertyName]; | ||
if (Array.isArray(targetArray)) { | ||
targetArray.push(value); | ||
input.value = ''; | ||
} else { | ||
console.warn(`The property "${propertyName}" is not an array or is undefined`); | ||
} | ||
} else { | ||
console.warn('No argument provided for the directive'); | ||
} | ||
} | ||
}); | ||
} else { | ||
console.warn('Input element not found within Chips component'); | ||
} | ||
}); | ||
} | ||
}; | ||
|
||
export default createChipOnBlur; |
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,6 @@ | ||
import { defineNuxtPlugin } from '#app'; | ||
import createChipOnBlur from '@/directives/createChipOnBlur'; | ||
|
||
export default defineNuxtPlugin((nuxtApp) => { | ||
nuxtApp.vueApp.directive('create-chip-on-blur', createChipOnBlur); | ||
}); |