上一页 1 2 3 4 5 6 7 8 ··· 13 下一页

2021年9月9日

摘要: 查看仓库当前状态 git-bash git diff 阅读全文
posted @ 2021-09-09 10:29 aisowe 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 查看历史提交记录 git-bash git log 如果觉得比较凌乱,可以用简略版:git log --pretty=oneline 阅读全文
posted @ 2021-09-09 10:28 aisowe 阅读(478) 评论(0) 推荐(0) 编辑
摘要: bash npm view vuex # or npm info vuex 阅读全文
posted @ 2021-09-09 10:28 aisowe 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 查看历史提交记录 git-bash git reflog 常配合git reset --hard用于回到未来的某个分支。 阅读全文
posted @ 2021-09-09 10:27 aisowe 阅读(205) 评论(0) 推荐(0) 编辑
摘要: index.js const img = document.createElement('img') // const img = new Image() img.classList.add('avatar') 阅读全文
posted @ 2021-09-09 10:26 aisowe 阅读(298) 评论(0) 推荐(0) 编辑
摘要: browser https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects https://github.com/Microsoft/TypeScript/tree/master/src/lib 阅读全文
posted @ 2021-09-09 10:26 aisowe 阅读(44) 评论(0) 推荐(0) 编辑
摘要: index.ts const lilei: [string, number] = ["Lilei", 23]; lilei.push(NaN); // 3 lilei.push("NaN"); // NaN lilei.push(true); // string | number -> Error 阅读全文
posted @ 2021-09-09 10:25 aisowe 阅读(190) 评论(0) 推荐(0) 编辑
摘要: webpack.config.js module.exports = { entry: { main: './src/index.js', }, } package.json { "scripts": { "watch": "webpack --watch" }, } 阅读全文
posted @ 2021-09-09 10:25 aisowe 阅读(24) 评论(0) 推荐(0) 编辑
摘要: index.ts class Foo { constructor(public name: string, public readonly age: number) {} } const foo = new Foo("foo", 23); console.log(foo.name); console 阅读全文
posted @ 2021-09-09 10:24 aisowe 阅读(154) 评论(0) 推荐(0) 编辑
摘要: index.js import React from 'react' import ReactDOM from 'react-dom' class ANumber extends React.Component { constructor() { super() this.state = { num 阅读全文
posted @ 2021-09-09 10:23 aisowe 阅读(215) 评论(0) 推荐(0) 编辑
摘要: tsconfig.json { "compilerOptions": { "target": "ESNEXT", "lib": ["DOM", "ESNEXT"], "module": "commonjs", "sourceMap": true, "outDir": "./dist", "modul 阅读全文
posted @ 2021-09-09 10:23 aisowe 阅读(94) 评论(0) 推荐(0) 编辑
摘要: index.js import React from 'react' import ReactDOM from 'react-dom' class Btn extends React.Component { render() { return <button onClick={() => alert 阅读全文
posted @ 2021-09-09 10:22 aisowe 阅读(489) 评论(0) 推荐(0) 编辑
摘要: index.html <a href="javascript:void(0)" onclick="alert('右究')">点击</a> 阅读全文
posted @ 2021-09-09 10:22 aisowe 阅读(30) 评论(0) 推荐(0) 编辑
摘要: index.ts import * as _ from 'lodash' const list = [ { name: 'a', gender: 1 }, { name: 'b', gender: 0 }, { name: 'c', gender: 1 }, { name: 'd', gender: 阅读全文
posted @ 2021-09-09 10:21 aisowe 阅读(43) 评论(0) 推荐(0) 编辑
摘要: index.ts import * as _ from 'lodash' const list = [ { name: 'a', gender: 1 }, { name: 'b', gender: 0 }, { name: 'c', gender: 1 }, { name: 'd', gender: 阅读全文
posted @ 2021-09-09 10:20 aisowe 阅读(40) 评论(0) 推荐(0) 编辑
摘要: npm npm i -S vuex main.js import Vue from 'vue' import Vuex from 'vuex' import App from './App.vue' Vue.use(Vuex) new Vue({ store: new Vuex.Store({ /* 阅读全文
posted @ 2021-09-09 10:19 aisowe 阅读(63) 评论(0) 推荐(0) 编辑
摘要: bash npm i -D webpack@4 # npm i -D webpack@4.x.x 阅读全文
posted @ 2021-09-09 10:19 aisowe 阅读(301) 评论(0) 推荐(0) 编辑
摘要: npm npm i -S lodash npm i -D @types/lodash 阅读全文
posted @ 2021-09-09 10:17 aisowe 阅读(344) 评论(0) 推荐(0) 编辑
摘要: Counter.vue <template> <button @click="increment">{{ count }}</button> </template> <script lang="ts"> import { defineComponent, ref } from "vue"; expo 阅读全文
posted @ 2021-09-09 10:15 aisowe 阅读(1276) 评论(0) 推荐(0) 编辑
摘要: Counter.vue <template> <button @click="increment">{{ count }}</button> </template> <script lang="ts"> import { reactive, toRefs } from "vue"; export d 阅读全文
posted @ 2021-09-09 10:15 aisowe 阅读(101) 评论(0) 推荐(0) 编辑
摘要: index.js function sleep(n = 0) { return new Promise((resolve) => { setTimeout(function () { resolve(); }, n); }); } async function clock() { while (tr 阅读全文
posted @ 2021-09-09 10:14 aisowe 阅读(77) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const app = new Koa(); app.use((ctx) => { switch (ctx.url) { case "/": ctx.body = "<h1>index.html</h1>"; break; d 阅读全文
posted @ 2021-09-09 10:14 aisowe 阅读(28) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const Router = require("koa-router"); const app = new Koa(); const router = new Router(); router.get("/", (ctx) = 阅读全文
posted @ 2021-09-09 10:13 aisowe 阅读(28) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const bodyParser = require("koa-bodyparser"); const app = new Koa(); app.use(bodyParser()); app.use(async (ctx) = 阅读全文
posted @ 2021-09-09 10:12 aisowe 阅读(73) 评论(0) 推荐(0) 编辑
摘要: index.js const fs = require("fs"); const Koa = require("koa"); const app = new Koa(); app.use(async (ctx) => { const html = fs.readFileSync("./index.h 阅读全文
posted @ 2021-09-09 10:11 aisowe 阅读(705) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const app = new Koa(); function bodyParser(ctx) { return new Promise((resolve, reject) => { let postData = ""; tr 阅读全文
posted @ 2021-09-09 10:11 aisowe 阅读(153) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const app = new Koa(); app.use((ctx) => { ctx.body = "Hello, World!"; }); app.listen(3000); 阅读全文
posted @ 2021-09-09 10:11 aisowe 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 首先,需要安装 Vue-CLI,版本大于 4.5.4,然后使用 vue create <project-name>初始化项目; 然后,项目初始化使用选项3:Manually select features,选择这几项,然后回车: Vue CLI v5.0.0-beta.0 ? Please pick 阅读全文
posted @ 2021-09-09 10:10 aisowe 阅读(302) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const app = new Koa(); app.use((ctx) => { const { request: { query: query1, querystring: queryString1 }, query, q 阅读全文
posted @ 2021-09-09 10:09 aisowe 阅读(417) 评论(0) 推荐(0) 编辑
摘要: index.js const Koa = require("koa"); const app = new Koa(); /** * a simple log middleware * @param {object} ctx */ function logger() { return async fu 阅读全文
posted @ 2021-09-09 10:09 aisowe 阅读(85) 评论(0) 推荐(0) 编辑
摘要: npm i -S koa 阅读全文
posted @ 2021-09-09 10:08 aisowe 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 构造函数式实例化对象、数组和函数 typeof new Object() 'object' // true Array.isArray(new Array()) // true typeof new Function() 'function' // true 字面量写法实例化对象、数组和函数 typ 阅读全文
posted @ 2021-09-09 10:02 aisowe 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 数组对象: Array 1. 前言 数组也好, 列表也好, 在不同的编程语言里面叫法虽然不一样, 但其本质是一样的, 作为最常用的对象, 其属性和方法是必须要牢记在心的, 以下是Array对象的完整属性方法示例. 2. 参数 情况1: 没参数 var arr = new Array(); // 实例 阅读全文
posted @ 2021-09-09 09:47 aisowe 阅读(56) 评论(0) 推荐(0) 编辑
摘要: <canvas id="gc" width="400" height="400"></canvas> <script> window.onload=function() { canv = document.getElementById("gc"); ctx = canv.getContext("2d 阅读全文
posted @ 2021-09-09 09:45 aisowe 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 正文 所谓表单组件就是跟用户有交互的、能取到值的、是 form 的表单项的组件。在 Vue、React 中,store 里面的数据是严格控制其变动方式的,store 中的 state 只能通过 commit 触发改变。而 Svelte 中的 store 的更新是“自带”的,通过 set、update 阅读全文
posted @ 2021-09-09 09:42 aisowe 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 正文 Svelte 中的 store 不仅有 state,也可以有 getters,不过名字叫:derived,不太好读,但英文意思很直观:衍生的,也就是说,经他生成的数据是由其他 state 衍生的,这其实就是 getters 的定义,而 getters 也可以理解成 store 中的计算属性,也 阅读全文
posted @ 2021-09-09 09:41 aisowe 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 正文 我们拿一个计数器举例,count 变量存在 store 中,我们用 count.set() 重置,用 count.subscribe() 订阅,用 count.update() 更新,一切看起来都很 OK,但实际上,如果想要更好的可维护性,这个 count 应该继续定义它的行为逻辑,也就是预定 阅读全文
posted @ 2021-09-09 09:41 aisowe 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 正文 下面代码中手动订阅与取消订阅的代码其实非常冗余,Svelte 提供了自动订阅的功能,可以自动为我们做订阅和取消订阅的操作。 <script> import { writable } from 'svelte/store' import {onDestroy} from 'svelte' con 阅读全文
posted @ 2021-09-09 09:40 aisowe 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 正文 存在某些 store-state,它们的变动来源只依赖一个地方,且跟项目业务逻辑无关,这时其他地方都不会去修改它。比如获取当前时间,这时就不需要在特定组件里面去做修改,而是直接在设定 time 的时候,就将变动规则传给他,然后它就自己在那儿触发就行了,不需要管它。 <script> impor 阅读全文
posted @ 2021-09-09 09:40 aisowe 阅读(43) 评论(0) 推荐(0) 编辑
摘要: 正文 以简单计数器为例,计数变量放在 store-state 中,它使用 svelte/store 中的 writable 方法,它会返回一个对象,通过调用对象上的 .set(val) 进行重置、调用 .update((val) => ...) 进行更新、调用 .subscribe(val => . 阅读全文
posted @ 2021-09-09 09:39 aisowe 阅读(445) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 13 下一页

导航