@guptat/spfx-spstencil
v0.0.5
Published
Stencil Component Starter
Maintainers
Readme
Stencil SPFx Custom Component
Component which calls anonymous API using jQuery and the SharePoint Rest API endpoint to get items from the list. (To be only used in SPFx projects for learning purpose)
Using this component
Script tag
<script src="https://unpkg.com/@guptat/[email protected]/dist/spstencil/spstencil.js"></script><my-component></my-component>
In a SPFx project app
- Create SPFx project with no javascript frmework using yomen genrator
- After creating the project, Run
npm install @guptat/spfx-spstencil --save - Add an import to the npm packages
import { defineCustomElements } from '@guptat/spfx-spstencil/loader'in webpart.ts file - In webpart.ts file add the function in the class
public onInit(): Promise<void> { defineCustomElements(window); return Promise.resolve(); } - In the class file in the render function add
<my-component></my-component>
