This repository has been archived by the owner on Jan 18, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose remove function for tag slot
ref: #235
- Loading branch information
Ernest
committed
Jun 26, 2021
1 parent
a91b89c
commit 77f8f72
Showing
4 changed files
with
62 additions
and
1 deletion.
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,47 @@ | ||
<!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 app = createApp({ | ||
name: 'app', | ||
setup() { | ||
const selectedOptions = ref(['i']) | ||
const options = ref(['i']) | ||
return { | ||
selectedOptions, | ||
options, | ||
} | ||
}, | ||
template: ` | ||
<vue-select | ||
v-model="selectedOptions" | ||
:options="options" | ||
multiple | ||
taggable | ||
> | ||
<template #tag="{ option, remove }"> | ||
<button @click.stop="remove">{{ option }}</button> | ||
</template> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// <reference types="cypress" /> | ||
import path from 'path' | ||
|
||
context('tag', () => { | ||
it('should expose remove function', () => { | ||
cy.visit(path.join(__dirname, 'remove.html')) | ||
cy.get('.vue-tag.selected').should('have.length', 1) | ||
|
||
cy.get('.vue-tag.selected').click() | ||
|
||
cy.get('.vue-tag.selected').should('have.length', 0) | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -319,6 +319,7 @@ New in `2.6.0+` | |
- **Attributes**: | ||
|
||
- `{OptionType}` option | ||
- `{Function}` remove | ||
|
||
### toggle | ||
|
||
|
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