# 2020.7.7 今天是每日时报陪伴您的第 364 天

[文章] 如何基于 EggJS 为团队定制自己的 Node.js 框架:https://zhuanlan.zhihu.com/p/154643011 (opens new window)

[文章] Vue3 SFC Improvements 这个更新将会非常有意思:https://github.com/vuejs/rfcs/pull/182 (opens new window)

[类库] 生成 ChangeLog 时,我们需要对 & 等一些特殊符号做处理,这时就会用到 escape-goat 这个类库了:https://github.com/sindresorhus/escape-goat (opens new window)

[类库] open 是一个跨平台的打开工具,可以打开 URL、文件、可执行文件,类似于 macOS 的 open 命令:https://github.com/sindresorhus/open (opens new window)

[工具] 可以搭建可视化表格的命令行工具,Rich:https://github.com/willmcgugan/rich#tables (opens new window)

# 示例 - Vue3 SFC Improvements

<template>
  <button @click="inc">{{ count }}</button>
</template>

<script setup>
import { ref } from "vue";

export const count = ref(0);
export const inc = () => count.value++;
</script>
<template>
  <div class="text">hello</div>
</template>

<script>
export default {
  data() {
    return {
      color: "red"
    };
  }
};
</script>

<style :vars="{ color }">
.text {
  color: var(--color);
}
</style>

# 示例 - open

const open = require("open");

(async () => {
  // Opens the image in the default image viewer and waits for the opened app to quit.
  await open("unicorn.png", { wait: true });
  console.log("The image viewer app quit");

  // Opens the URL in the default browser.
  await open("https://sindresorhus.com");

  // Opens the URL in a specified browser.
  await open("https://sindresorhus.com", { app: "firefox" });

  // Specify app arguments.
  await open("https://sindresorhus.com", {
    app: ["google chrome", "--incognito"]
  });
})();

# 示例 - escape-goat

const { htmlEscape, htmlUnescape } = require("escape-goat");

htmlEscape("🦄 & 🐐");
//=> '🦄 &amp; 🐐'

htmlUnescape("🦄 &amp; 🐐");
//=> '🦄 & 🐐'

htmlEscape("Hello <em>World</em>");
//=> 'Hello &lt;em&gt;World&lt;/em&gt;'

const url = 'https://sindresorhus.com?x="🦄"';

htmlEscape`<a href="${url}">Unicorn</a>`;
//=> '<a href="https://sindresorhus.com?x=&quot;🦄&quot;">Unicorn</a>'

const escapedUrl = "https://sindresorhus.com?x=&quot;🦄&quot;";

htmlUnescape`URL from HTML: ${escapedUrl}`;
//=> 'URL from HTML: https://sindresorhus.com?x="🦄"'

# 配图 - Rich 表格

Last Updated: 7/7/2020, 6:21:55 PM