2018年9月27日

stenciljs 学习十三 @stencil/router 组件使用说明

摘要: @stencil/router 组件包含的子组件 stencil-router stencil-route-switch stencil-route stencil-route-link stencil-route-redirect stencil-route-title stencil-route 阅读全文

posted @ 2018-09-27 15:23 荣锋亮 阅读(597) 评论(0) 推荐(0) 编辑

stenciljs 学习十二 官方doc 路由使用的例子

摘要: 路由在单页面应用开发中是一个相对比较重要的位置 以下为官方网站的路由配置 <stencil-router scrollTopOffset={0}> <stencil-route-switch> <stencil-route url="/" component="landing-page" exact 阅读全文

posted @ 2018-09-27 10:57 荣锋亮 阅读(353) 评论(0) 推荐(0) 编辑

stenciljs 学习十一 pwa 支持

摘要: stenciljs 对于pwa 的支持是自动注入的,我们只需要简单的配置,stenciljs使用workbox 配置 默认配置 { skipWaiting: true, clientsClaim: true, globPatterns: [ '**/*.{js,css,json,html,ico,p 阅读全文

posted @ 2018-09-27 09:10 荣锋亮 阅读(311) 评论(0) 推荐(0) 编辑

stenciljs 学习十 服务器端渲染

摘要: stenciljs提供了 ssr 支持,对于express 最简单的就是使用提供的中间件 express 集成 const express = require('express'); const stencil = require('@stencil/core/server'); // create 阅读全文

posted @ 2018-09-27 08:59 荣锋亮 阅读(419) 评论(0) 推荐(0) 编辑

stenciljs 学习九 使用jsx

摘要: 可以使用jsx 方便组件的开发 基本格式 主要是render 函数 class MyComponent { render() { return ( <div> <h1>Hello World</h1> <p>This is JSX!</p> </div> ); } } 数据绑定 render() { 阅读全文

posted @ 2018-09-27 08:54 荣锋亮 阅读(532) 评论(0) 推荐(0) 编辑

stenciljs 学习八 组件测试

摘要: 测试对于框架来说比较重要,对于web 组件的测试同样很重要,类似的jest 很方便,stenciljs也是基于jest 开发的 包含两个核心api render(), flush() 测试配置 package.json 配置 "devDependencies": { ... "@types/jest 阅读全文

posted @ 2018-09-27 08:53 荣锋亮 阅读(357) 评论(0) 推荐(0) 编辑

stenciljs 学习七 路由

摘要: stenciljs路由类似react router 安装 npm install @stencil/router --save 使用 导入包 import "@stencil/router" 添加路由组件配置 包含的组件 stencil-router 项目中应该只有一个模板路由器组件。此组件控制与浏 阅读全文

posted @ 2018-09-27 08:52 荣锋亮 阅读(412) 评论(0) 推荐(0) 编辑

导航