{"id":557,"date":"2020-03-02T16:59:57","date_gmt":"2020-03-02T08:59:57","guid":{"rendered":"https:\/\/blog.cqdefxxx.com\/?p=557"},"modified":"2020-03-02T16:59:57","modified_gmt":"2020-03-02T08:59:57","slug":"vue-%e8%bf%87%e6%bb%a4%e5%99%a8%ef%bc%88filter%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.viter.top\/index.php\/2020\/03\/02\/vue-%e8%bf%87%e6%bb%a4%e5%99%a8%ef%bc%88filter%ef%bc%89\/","title":{"rendered":"Vue-\u8fc7\u6ee4\u5668\uff08filter\uff09"},"content":{"rendered":"<pre class=\"pure-highlightjs\"><code class=\"\">&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;meta charset=\"utf-8\"&gt;\n&lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"&gt;\n&lt;title&gt;Examples&lt;\/title&gt;\n&lt;meta name=\"description\" content=\"\"&gt;\n&lt;meta name=\"keywords\" content=\"\"&gt;\n&lt;link href=\"\" rel=\"stylesheet\"&gt;\n&lt;style&gt;\n\n&lt;\/style&gt;\n\n&lt;script src=\"https:\/\/unpkg.com\/axios\/dist\/axios.min.js\"&gt;&lt;\/script&gt;\n&lt;script type=\"text\/javascript\" src=\"lib\/vue.js\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n    &lt;!-- &lt;h1 class=\"animated hinge infinite\"&gt;1111111111111&lt;\/h1&gt; --&gt;\n\n    &lt;div id=\"box\"&gt;\n       &lt;ul&gt;\n         &lt;li v-for=\"data in datalist\"&gt;\n            {{data.nm}}\n           &lt;!--  &lt;img :src=\"handlePath(data.img)\"\/&gt; --&gt;\n           &lt;img :src=\"data.img | kerwinpath\"\/&gt;\n\n           {{ data.img | kerwinpath }}\n         &lt;\/li&gt;\n       &lt;\/ul&gt;\n    &lt;\/div&gt;\n\n    &lt;script&gt;\n\n      \/\/\u8fc7\u6ee4\u5668 ---- \u6570\u636e\u683c\u5f0f\u5316\n      Vue.filter(\"kerwinpath\",function(path){\n        return path.replace('w.h','128.180')\n      })    \n\n\n      var vm = new Vue({\n        el:\"#box\",\n        data:{\n          isShow:true,\n          datalist:[]\n        },\n\n        mounted(){\n          axios.get(\"test.json\").then(res=&gt;{\n            console.log(res.data);\n            this.datalist = res.data.movieList\n          })\n        },\n\n        methods:{\n          handlePath(path){\n            console.log(path);\n            return path.replace('w.h','128.180');\n          }\n        }\n      })\n\/\/\"http:\/\/p0.meituan.net\/w.h\/moviemachine\/f7d2ad70eb79d6d9b8a197713db9b8c41711752.jpg\"\n\n\/\/ https:\/\/p0.meituan.net\/128.180\/moviemachine\/f7d2ad70eb79d6d9b8a197713db9b8c41711752.jpg\n    &lt;\/script&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset= &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[9,10],"_links":{"self":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/557"}],"collection":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/comments?post=557"}],"version-history":[{"count":1,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/557\/revisions"}],"predecessor-version":[{"id":592,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/posts\/557\/revisions\/592"}],"wp:attachment":[{"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/media?parent=557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/categories?post=557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.viter.top\/index.php\/wp-json\/wp\/v2\/tags?post=557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}