<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>ECMAScript 2015</anon>
    <anon>Vue.js</anon>
  </categories>
  <description>Vue.jsのcomputedでアロー関数*1を使ってthisで混乱したので覚え書きとして。結論は以下の通りです。 Vue.jsのmethodsやcomputedでは匿名関数*2を使った方が素直 アロー関数におけるthisの挙動は仕様 thisの仕様については詳細に調べていませんが、サンプルコードの結果からアロー関数と匿名関数では次表の違いがあります。methodsやcomputedで扱いたいthisの実体は基本的にVueなので、匿名関数を使った方が素直に扱えるかと思います。 関数式 thisの型 アロー関数 Window 匿名関数 Vue サンプルコード &lt;html lang=&quot;ja&quot;&gt; &lt;…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2019%2F09%2F07%2F180840&quot; title=&quot;Vue.jsのmethodsやcomputedにおける関数式の種類とthis - potisanのプログラミングメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-09-07 18:08:40</published>
  <title>Vue.jsのmethodsやcomputedにおける関数式の種類とthis</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2019/09/07/180840</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
