preact


小程序跨页面交互的作用与方法

筅森魡賤 提交于 2020-01-07 02:03:28
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 去年年末,微信小程序的分包大小已经到达了 12M 大小,一方面说明小程序的确逐步为开发者放开更大的权限,另一方面也说明了对于某些小程序 8M 的大小已经不够用了。我个人今年也是在开发一个 to B 小程序应用。这里列举一些跨页面交互的场景。 对于 B 端应用的业务需求来说,小程序开发的复杂度相对比网页开发要复杂一些。一个是双线程的处理机制问题,另一个是页面栈之间交互问题。 注: 笔者目前只需要开发微信小程序,为了在小程序页面中可以使用 properties behaviors observers 等新功能,已经使用 Component 构造器来构造页面。具体可以参考 微信小程序 Component 构造器 。如果你也没有多端开发的需求,建议尝试使用,可以得到不错的体验。 性能优化类 对于小程序在页面中点击触发 wx.navigateTo 跳转其他页面,中间会有一段时间的空白加载期(对于分包出去的页面,空白期则会更长),但是这是小程序内部机制,没有办法进行优化。我们只能眼睁睁的等待这段没有意思的空白期过去。 当考虑到跳转页面后的第一件事情便是取数逻辑,那么我们是否能够进行优化呢?答案是肯定的。我们没有办法直接在当前页面取得数据之后再进行跳转操作(这样操作更不好),但是我们却可以利用缓存当前的请求

Pass array of strings to React component with string coming from json file and allow inline span tags

社会主义新天地 提交于 2019-12-11 16:55:53
问题 I'm trying to get an array of strings to display as paragraphs and allow an inline span tag inside of these strings. My issue comes is when the value is added inside the paragraph the decodes the "<" and ">" tag start and ends to their decoded values "<" and ">" Is there an easy way to get this working without making a specific component for this case? My React component is as follows const Paragraphs = ({ data, languageText }) => { if (data) { const texts = languageText[data.languageKey];

What makes a React library require preact-compat?

烈酒焚心 提交于 2019-12-11 13:46:48
问题 I have noticed that certain libraries such as classnames are readily available in Preact but others like styled-components require preact-compat . What makes a React library unsupported natively in preact that it requires the use of preact-compat? 回答1: Disclaimer: I work on preact. There are several APIs in react that are not needed for preact . But because existing third-party libraries have been developed for those APIs we published preact-compat which re-implements them on top of preact .

Scene.js 库:CSS创建动画基于时间轴的动画

那年仲夏 提交于 2019-12-07 02:02:21
Scene.js 是一个基于 JavaScript 时间轴的动画库,用于创建动画网站,作为一个动画时间轴库,它允许你创建对象的移动和位置的时间顺序。 此外,由于 Scene.js 的语法类似于 CSS 动画,同时还支持 JavaScript 和 CSS 的播放方法,因此使用起来简单又方便。在本文中,我将详细介绍它的主要特点。 可同时控制多个元素 要知道,动画元素很难控制,因为动画的开始和结束时间并不同。 来源:https://github.com/daybrush/scenejs-timeline 而 Scene.js 可以同时控制多个动画元素,即使开始和结束时间都不同,也可以进行重播。 你可以通过同时开始和结束来重播一个场景。 Scene.js 还可以让你完全控制时间,这样你就可以准确地显示当前时间的移动情况。 通过转换 CSS 语法很容易使用 Scene.js 类似于 CSS 使用关键帧的方式,允许按原样使用 CSS 属性。因此,那些用过 CSS 动画的人可以很容易地使用 Scene.js。以下是 CSS 关键帧的代码。 .animate { animation-name: keyframes1; animation-duration: 4; animation-iteration-count: 3; animation-timing-function: ease-in-out

Wrong components rendered by Preact

流过昼夜 提交于 2019-11-30 01:20:24
I'm using Preact (for all intents and purposes, React) to render a list of items, saved in a state array. Each item has a remove button next to it. My problem is: when the button is clicked, the proper item is removed (I verified this several time), but the items are re-rendered with the last item missing, and the removed one still there. My code (simplified): import { h, Component } from 'preact'; import Package from './package'; export default class Packages extends Component { constructor(props) { super(props); let packages = [ 'a', 'b', 'c', 'd', 'e' ]; this.setState({packages: packages});

Wrong components rendered by Preact

有些话、适合烂在心里 提交于 2019-11-28 22:49:56
问题 I'm using Preact (for all intents and purposes, React) to render a list of items, saved in a state array. Each item has a remove button next to it. My problem is: when the button is clicked, the proper item is removed (I verified this several time), but the items are re-rendered with the last item missing, and the removed one still there. My code (simplified): import { h, Component } from 'preact'; import Package from './package'; export default class Packages extends Component { constructor

工具导航Map