mirror of
https://github.com/iconify/iconify.git
synced 2024-12-12 13:47:49 +00:00
Merge remote-tracking branch 'antfu/feat/vue-ssr' into next
This commit is contained in:
commit
24bee18f46
@ -243,6 +243,12 @@ export const Icon = defineComponent<IconProps>({
|
|||||||
// Set initial data
|
// Set initial data
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
// Current icon name
|
||||||
|
_name: '',
|
||||||
|
|
||||||
|
// Loading
|
||||||
|
_loadingIcon: null,
|
||||||
|
|
||||||
// Mounted status
|
// Mounted status
|
||||||
iconMounted: false,
|
iconMounted: false,
|
||||||
|
|
||||||
@ -252,12 +258,6 @@ export const Icon = defineComponent<IconProps>({
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
// Current icon name
|
|
||||||
this._name = '';
|
|
||||||
|
|
||||||
// Loading
|
|
||||||
this._loadingIcon = null;
|
|
||||||
|
|
||||||
// Mark as mounted
|
// Mark as mounted
|
||||||
this.iconMounted = true;
|
this.iconMounted = true;
|
||||||
},
|
},
|
||||||
@ -354,7 +354,7 @@ export const Icon = defineComponent<IconProps>({
|
|||||||
const props = this.$attrs;
|
const props = this.$attrs;
|
||||||
|
|
||||||
// Get icon data
|
// Get icon data
|
||||||
const icon: IconComponentData | null = this.iconMounted
|
const icon: IconComponentData | null = (this.iconMounted || props.ssr)
|
||||||
? this.getIcon(props.icon, props.onLoad)
|
? this.getIcon(props.icon, props.onLoad)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
@ -67,4 +67,12 @@ interface IconifyElementProps {
|
|||||||
/**
|
/**
|
||||||
* Mix of icon properties and HTMLElement properties
|
* Mix of icon properties and HTMLElement properties
|
||||||
*/
|
*/
|
||||||
export type IconProps = IconifyElementProps & IconifyIconProps;
|
export interface IconProps extends IconifyElementProps, IconifyIconProps {
|
||||||
|
/**
|
||||||
|
* Try load icon on first render during SSR
|
||||||
|
*
|
||||||
|
* This is a low-level API for framework integrations, you don't usually need to use it directly.
|
||||||
|
* Note this might hydration mismatches if the icon data is not handled correctly, use with caution.
|
||||||
|
*/
|
||||||
|
ssr?: boolean
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user