0.0.5 • Published 6 years ago
@guptat/spfx-spstencil v0.0.5
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/spfx-spstencil@0.0.1/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>