-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #628 from Tencent/dev
v3.15.1
- Loading branch information
Showing
20 changed files
with
394 additions
and
227 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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
<link href="./lib/demo.css" rel="stylesheet"/> | ||
|
||
<script src="../dist/vconsole.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
</head> | ||
<body ontouchstart> | ||
<div class="page"> | ||
|
@@ -38,9 +39,9 @@ | |
.on('init', function() { console.log(this.id, 'init'); }) | ||
.on('renderTab', function(cb) { | ||
console.log(this.id, 'renderTab'); | ||
cb('<div>I am ' + this.id+'</div>'); | ||
cb('<div id="tab1">I am ' + this.id+'</div>'); | ||
}) | ||
.on('ready', function() { console.log(this.id, 'ready'); }) | ||
.on('ready', function() { console.log(this.id, 'ready', document.querySelector('#tab1')); }) | ||
.on('show', function() { console.log(this.id, 'show'); }) | ||
.on('hide', function() { console.log(this.id, 'hide'); }) | ||
.on('showConsole', function() { console.log(this.id, 'showConsole'); }) | ||
|
@@ -94,7 +95,7 @@ | |
|
||
function newTabUseJQuery() { | ||
console.info('newTabUseJQuery() Start'); | ||
var tab = new window.vConsole.VConsolePlugin('tab4', 'Tab4'); | ||
var tab = new window.VConsole.VConsolePlugin('tab4', 'Tab4'); | ||
var $html = $('<div><a href="javascript:;">Alert</a></div>'); | ||
$html.find('a').click(function() { | ||
alert('OK'); | ||
|
@@ -108,7 +109,7 @@ | |
|
||
function newTabUseDOM() { | ||
console.info('newTabUseDOM() Start'); | ||
var tab = new window.vConsole.VConsolePlugin('tab5', 'Tab5'); | ||
var tab = new window.VConsole.VConsolePlugin('tab5', 'Tab5'); | ||
var $elm = document.createElement('DIV'); | ||
$elm.innerHTML = '<p>It works</p>'; | ||
tab.on('renderTab', function(cb) { | ||
|
@@ -136,4 +137,4 @@ | |
console.info('removePlugin() End'); | ||
} | ||
|
||
</script> | ||
</script> |
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
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,36 +1,41 @@ | ||
<script lang="ts"> | ||
import { onMount, onDestroy } from 'svelte'; | ||
import { useResizeObserver, hasResizeObserver } from './resizeObserver'; | ||
export let show: boolean; | ||
export let show: boolean = !hasResizeObserver(); | ||
export let top: boolean; | ||
export let onResize: (height: number) => void = () => {}; | ||
let item: HTMLDivElement | undefined; | ||
let observer: ResizeObserver | null = null; | ||
let isObservable = hasResizeObserver(); | ||
onMount(() => { | ||
if (show) { | ||
onResize(item.getBoundingClientRect().height); | ||
} | ||
observer = new ResizeObserver((entries) => { | ||
const entry = entries[0]; | ||
if (show) onResize(entry.contentRect.height) | ||
}); | ||
observer.observe(item); | ||
if (isObservable) { | ||
const ResizeObserverPolyfill = useResizeObserver(); | ||
observer = new ResizeObserverPolyfill((entries) => { | ||
const entry = entries[0]; | ||
if (show) onResize(entry.contentRect.height) | ||
}); | ||
observer.observe(item); | ||
} | ||
}); | ||
onDestroy(() => { | ||
observer.disconnect(); | ||
if (isObservable) { | ||
observer.disconnect(); | ||
} | ||
}); | ||
</script> | ||
|
||
<div | ||
bind:this={item} | ||
class="vc-scroller-item" | ||
style:display={show ? "block" : "none"} | ||
style:top="{top}px" | ||
style:display={show ? 'block' : 'none'} | ||
style:top="{isObservable ? top + 'px' : 'auto'}" | ||
> | ||
<slot /> | ||
</div> |
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
Oops, something went wrong.