-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add vue-at demo for gh119 & misc
- Loading branch information
Showing
5 changed files
with
54 additions
and
9 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,49 @@ | ||
// await loadJs('https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js') | ||
await loadJs('https://unpkg.com/[email protected]/dist/vue.min.js') | ||
|
||
// await loadJs('https://unpkg.com/vue-at') | ||
await loadJsForceUmd({ | ||
url: 'https://unpkg.com/[email protected]/dist/vue-at.js', | ||
name: 'VueAt', | ||
}) | ||
|
||
appendCss(` | ||
.container { padding: 20px } | ||
.editor { margin-top:20px; padding:4px 8px; height:120px; border:solid 1px gray; white-space:pre-wrap } | ||
.atwho-remove { cursor: pointer } | ||
`) | ||
|
||
window.atwhoRemoveItem = target => { | ||
let tag = target.parentNode.parentNode | ||
tag.parentNode.removeChild(tag) | ||
} | ||
|
||
let App = { | ||
components: { At: VueAt }, | ||
template: ` | ||
<div class="container"> | ||
<h1>Demo for vue-at#119</h1> | ||
<div v-for="link in links"> | ||
<a target="_blank" :href="link">{{link}}</a> | ||
</div> | ||
<at :members="members" v-model="input"> | ||
<template v-slot:embeddedItem="s"> | ||
<span><span class="tag">[ @{{ s.current }} <span class="atwho-remove" onclick="atwhoRemoveItem(this)">×</span> ]</span></span> | ||
</template> | ||
<div class="editor" contenteditable></div> | ||
</at> | ||
</div> | ||
`, | ||
data() { | ||
return { | ||
links: [ | ||
'https://github.com/fritx/vue-at', | ||
'https://github.com/fritx/vue-at/issues/119', | ||
], | ||
members: [ | ||
'fritx', 'linguokang', 'huangruichang' | ||
], | ||
input: '<span data-at-embedded="" contenteditable="false"> <span class="tag">[ @fritx <span onclick="atwhoRemoveItem(this)" class="atwho-remove">×</span> ]</span> </span> <span data-at-embedded="" contenteditable="false"> <span class="tag">[ @huangruichang <span onclick="atwhoRemoveItem(this)" class="atwho-remove">×</span> ]</span> </span> ' | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,8 +1,8 @@ | ||
// await loadJs('https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js') | ||
await loadJs('https://unpkg.com/[email protected]/dist/vue.min.js') | ||
|
||
// await loadJs('https://unpkg.com/three@0.115.0/build/three.min.js') | ||
await loadJs('https://unpkg.com/three@0.81.2/build/three.min.js') | ||
// await loadJs('https://unpkg.com/three@0.81.2/build/three.min.js') | ||
await loadJs('https://unpkg.com/three@0.115.0/build/three.min.js') | ||
|
||
// await loadJs('https://unpkg.com/[email protected]/lib/VueThreejs.umd.min.js') | ||
await loadJs('https://unpkg.com/[email protected]/lib/VueThreejs.umd.js') | ||
|
@@ -42,9 +42,6 @@ let App = { | |
} | ||
} | ||
}, | ||
created() { | ||
this.handleResize = _.debounce(this.handleResize, 2000) | ||
}, | ||
mounted() { | ||
mountNode.addEventListener('resize', this.handleResize) | ||
}, | ||
|
@@ -56,8 +53,6 @@ let App = { | |
this.ui.rotation.x += 0.01 | ||
this.ui.rotation.y += 0.01 | ||
}, | ||
handleResize() { | ||
triggerPreview() | ||
} | ||
handleResize: _.debounce(triggerPreview, 2000) | ||
} | ||
} |
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