-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: highlight closest option if original is unavailable
- Loading branch information
Ernest
committed
Mar 27, 2021
1 parent
28e0ae9
commit 34a277a
Showing
3 changed files
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link | ||
type="text/css" | ||
rel="stylesheet" | ||
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" | ||
/> | ||
<link type="text/css" rel="stylesheet" href="/dist/index.css" /> | ||
<script src="https://unpkg.com/vue@next/dist/vue.global.prod.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script src="/dist/vue-next-select.iife.js"></script> | ||
<script> | ||
const { ref, createApp } = Vue | ||
const deepCopy = value => JSON.parse(JSON.stringify(value)) | ||
const app = createApp({ | ||
name: 'app', | ||
setup() { | ||
const selectedOptions = ref(null) | ||
const options = ref(['i', 'love', 'vue']) | ||
|
||
const handleRemove = option => { | ||
if (option === undefined) return | ||
options.value.splice(options.value.indexOf(option), 1) | ||
} | ||
|
||
return { | ||
selectedOptions, | ||
options, | ||
handleRemove, | ||
} | ||
}, | ||
template: ` | ||
<vue-select | ||
v-model="selectedOptions" | ||
:options="options" | ||
@removed="handleRemove" | ||
></vue-select> | ||
`, | ||
}) | ||
|
||
app.component('vue-select', VueNextSelect) | ||
app.mount(document.querySelector('#app')) | ||
</script> | ||
</body> | ||
</html> |
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