27 Matching Annotations
  1. Nov 2023
    1. document.querySelector()获取的是第一个符合条件的dom元素;

      赋值给多个变量并不会赋值该元素,只是多个指针,所以sect.appendChild(linkPara);是移动而不是复制

  2. Aug 2023
    1. 如果你不希望组件的根元素继承 attribute,你可以在组件的选项中设置 inheritAttrs: false

      默认是true, 代表父组件中传递给子组件但子组件未声明为props的属性将自动应用于子组件的根元素。

    1. formatter字符串模板

      formatter回调函数

      所接受参数params中包含的信息

      • params.name - 取自series.data.name
      • params.value - series.data.value
      • params.percent - series.data.percent 是不带百分号的字符串,它是echarts根据data.value计算得来的,不需要data中有percent属性
      • params.data - series.data,其中series.data.percent是带百分号的字符串(前提是后端返回'80.00%'这样的数据),若data中未定义percent,值为undefined

      rich富文本标签

      具体设置见官网-文档-教程-富文本标签

      FAQ

      1. 假如series.data格式如下{name:"代销机构", percent: "2.93%", value: "95737686"} 我希望label显示"代销机构\n95,737,686\n2.93%" 但使用'{b}\n{c}\n{d}'的话数据项值没有千位符,该怎么处理呢

      答: 若想要标签显示千位符,必须使用formatter,仅靠字符串模板做不到。

      1. 把formatter返回值从return {a|${v.name}}\n{a|${num}}\n{a|${v.percent}} 换成return ${v.name}\n${num}\n${v.percent}后label的内容没变但文字排列不居中了,可能是什么原因

      答: formatter函数中使用{a|}、{b|}和{c|}来应用不同的富文本样式,富文本样式的名称及规则自定义在label.rich里, rich: {align: center}

    1. 撤销提交: git commit --amend 生成新提交,覆盖旧提交。如果在上次提交后有修改文件需重新执行git add ,再执行git commit --amend,否则就是单纯修改提交信息,而未包含新的改变

      撤消暂存和撤消修改的命令都可以从git status中找到,分别是: - git reset HEAD <file> 从暂存区放回工作区 - git restore <file> 将工作区文件还原到未更改状态(不可恢复)

    1. git 数据模型

      文件 blob:一堆字节

      文件夹/目录 tree: 名字-tree/blob的映射集合


      最上层目录的一个快照代表一次提交

      每个提交指向它的parents,一个提交可能有多个parent。

      一个提交包含parents, metadata(message and author), and snapshot of the top-level tree


      object可以是blob,tree, or commit

  3. May 2023
    1. 用な形容词来修饰它,「な」还是不能省掉的

      如果是名词后面也要加な 雨なので 名词和な形容词在语法上同类

  4. Apr 2023
    1. site有两种状态:open and blocked。

      处于open状态的site如果能连到最上层,则称为full open site。会有水进入该site。没连到最上层的open site是empty open site。

      如果最底层存在一个full open site,则称整个系统渗透。此时有水从最上方流至最底部。

  5. Sep 2022
    1. Exercise 1.2.1

      猜测:该方法是static,需在class上调用,class有一个static变量和一个non-static变量都叫重量,如果class重量大则返回class,如果d2重量大,则返回d2。

      实践:事实证明static变量和non-static变量互相之间也不能重名,所以会报错。 其次,在类上调用方法,类是静态上下文,方法里若访问了非静态变量也会报错——无法从静态上下文中引用非静态变量。 再者,this专指具体的instance,this也是非静态变量,不能指代类,所以在类上调用的方法如果访问this也会报错——无法从静态上下文中引用非静态变量this。

    2. python不能打印字符串+数字,但java可以。 因为java限制数据类型必须固定,所以字符串+数字的类型只能是字符串,不能是数字,java就会按照字符串类型对待打印参数,不会报错。 但python不限制变量的数据类型,它不知道字符串+数字到底是数字还是字符串,于是报错。

  6. Jul 2022
  7. Jun 2022
    1. 使用场景,用<transition>包裹用了v-if的元素, 然后在css里用v-enter-from等class控制

      如果使用transition .v-enter-from { / initial state / opacity: 0; transform: translateY(-30px); } .v-enter-active { / watch for all css properties that might be animated / transition: all 0.3s ease-out; } .v-enter-to { / final state / opacity: 1; transform: translateY(0); }

      如果使用animation .v-enter-active { animation: identifier 0.3s ease-out; }

  8. May 2022
    1. In the context of this course, full stack web development means that we focus on all parts of the application: the frontend, the backend, and the database. Sometimes the software on the server and its operating system are seen as parts of the stack, but we won't go into those.

      这门课将涉及frontend, backend 和 database, 但不涉及服务器端运行的软件及其操作系统

    2. single-page app vs. tradition app -- difference: 1. form element. no method/action attributes in SPA, have a submit event listener 2. network. the browser only send on request to the server as opposed to five requests in traditional app 3. 顺序不同, spa先将note push到本地array里,再向server存储。传统网页是先向网页存储,再重定向重新加载更新后的服务器数据

    3. The server responds with HTTP status code 302. This is a URL redirect, with which the server asks the browser to do a new HTTP GET request to the address defined in the header's Location - the address notes.

      302 redirect

      first do POST request to /new_note (which is defined in form's action attribute), then redirect, do a GET request to /notes (as shown in Response Headers' Location)

    1. 组件名应该由粗至细(指从左向右读)

      html文件对大小写不敏感,所以用PascalCase相当于没用,所以只能用kebab-case, 通过-将vue组件和html原生ele区分

    1. paren component里面给child component写了class, 这个class会落在child component的root element上,如果root ele本身有class两者合并。前提:只有一个root ele

      类似的有style, v-on event listener, 对于后者,root ele of child 上发生的事件会唤起parent methods, 如果root ele本身也有listener, 两者同时被唤起。

      如果root ele是另一个component, 则继续往下传给这个component的root ele.

      注意: 1. 往下传的attributes不包括已在props中声明的那些,往下传的v-on listeners不包括在当前组件里声明的事件(我不理解,什么叫当前组件声明的事件)的listeners 2. 往下传的attr可以被当前组件的child作为props接收,前提是在child组件里声明 当前组件是子组件,最终接受的是grand child

      如果不想把继承的属性放到root ele, 而是放在其他地方,则要diable inheritance, 然后在想用的地方使用 $attrs

    1. 简言之:跳级传递

      在上层provide props and handlers

      在下层inject

      解决的场景:一个prop或emits从组件不同层级之间传递,但有些组件只做中转站,却没有使用这些传递的prop&emit

      疑问:是必须使用computed才能具备reactivity吗,官网给出的例子是,但udemy课里的例子不是,难道因为前者是用户改变provided data,后者是从源码改变?