Skip to content

Latest commit

 

History

History
98 lines (58 loc) · 2.18 KB

README.md

File metadata and controls

98 lines (58 loc) · 2.18 KB

vue3-sfc-loader

Globals

vue3-sfc-loader

Index

Interfaces

Type aliases

Variables

Functions

Type aliases

File

Ƭ File: string | { content: string ; extname: string }

Defined in index.ts:75

Represents the content of the file or the content and the extension name.

Variables

version

Const version: string = process.env.VERSION

Defined in index.ts:278

the version of the library (process.env.VERSION is set by webpack, at compile-time)

Functions

loadModule

loadModule(path: string, options?: Options): Promise<Module>

Defined in index.ts:750

This is the main function.

Parameters:

Name Type Default value Description
path string - The path of the .vue file. If path is not a path (eg. an string ID), your getFile function must return a File object.
options Options throwNotDefined('options') The options

Returns: Promise<Module>

A Promise of the component

example using Vue.defineAsyncComponent:

	const app = Vue.createApp({
		components: {
			'my-component': Vue.defineAsyncComponent( () => loadModule('./myComponent.vue', options) )
		},
		template: '<my-component></my-component>'
	});

example using await:

;(async () => {

		const app = Vue.createApp({
			components: {
				'my-component': await loadModule('./myComponent.vue', options)
			},
			template: '<my-component></my-component>'
		});

})()
.catch(ex => console.error(ex));