这篇文章旨在为刚接触 wechat_spider 的人提供一个快速了解这个项目基本原理的途径。
首先我们随便进入一个微信公众号详情页。
在 iOS 中,我们通过 Core Graphics (也叫 Quarz 2D) 来绘图,而在 Core Grapihcs 之上的 UIKit 又封装了如 UIBeizerPath 等高级 api,这里就来简单的谈谈基础和技巧。
对于 UIView 来说,我们可以重写 draw(_:)
方法来进行绘图,官方文档中对它的描述是:
Specifically, UIKit creates and configures a graphics context for drawing and adjusts the transform of that context so that its origin matches the origin of your view’s bounds rectangle.
const jsdom = require("jsdom"); | |
const { JSDOM } = jsdom; | |
const fs = require("fs"); | |
const files = [ | |
"202012.html", | |
"202111.html", | |
"202112.html", | |
"202201.html", | |
"202202.html", |
import GlobalSpinner from '@/components/GlobalSpinner' | |
import { contextFactory } from './helpers/contextFactory' | |
import { useToggleState } from '@/hooks/useToggleState' | |
type GlobalSpinnerContextProviderProps = { | |
children: React.ReactNode | |
} | |
const GlobalSpinnerContextProvider = ( | |
props: GlobalSpinnerContextProviderProps |
import { createContext, useContext } from 'react' | |
export const contextFactory = <A extends unknown | null>() => { | |
const context = createContext<A | undefined>(undefined) | |
const useCtx = () => { | |
const ctx = useContext(context) | |
if (ctx === undefined) { | |
throw new Error('useContext must be used inside of a Provider with a value.') | |
} | |
return ctx |
import { FunctionComponent } from "react"; | |
import styled, { keyframes, css } from "styled-components"; | |
const SkeletonLoader: FunctionComponent<{ | |
isLoading?: boolean; | |
}> = (props) => { | |
return ( | |
<Content isLoading={props.isLoading}> | |
{props.isLoading && <Loader />} | |
{props.children} |
// use after view has been layout | |
extension UIView | |
{ | |
// different inner shadow styles | |
public enum innerShadowSide | |
{ | |
case all, left, right, top, bottom, topAndLeft, topAndRight, bottomAndLeft, bottomAndRight, exceptLeft, exceptRight, exceptTop, exceptBottom | |
} | |