惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
G
Google Developers Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
V
Vulnerabilities – Threatpost
Hugging Face - Blog
Hugging Face - Blog
I
Intezer
S
Securelist
Forbes - Security
Forbes - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
Y
Y Combinator Blog
N
News | PayPal Newsroom
S
Schneier on Security
O
OpenAI News
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
Simon Willison's Weblog
Simon Willison's Weblog
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
N
News and Events Feed by Topic
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
The Cloudflare Blog
Last Week in AI
Last Week in AI
博客园 - 司徒正美
L
LangChain Blog
C
CERT Recently Published Vulnerability Notes
L
LINUX DO - 热门话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Hacker News
The Hacker News
博客园 - Franky
Attack and Defense Labs
Attack and Defense Labs
Security Latest
Security Latest
T
Tailwind CSS Blog
博客园_首页
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Security Blog
Microsoft Security Blog
V2EX - 技术
V2EX - 技术
腾讯CDC
V
V2EX

博客园 - IT-caijw

claude + trae Redis 介绍与 Node.js 使用教程 技术人日常避坑手册:高效工作,少踩坑 AI应用开发-本地大模型部署与API调用实战:LM Studio完整教程 Cursor AI 实用指南:10个具体示例 AI 是搭子不是替代者:我用大模型工具(cursor,trae)编程的一年经验总结 uniapp 闪屏页被拉伸解决方案 9图制作 X-ECharts:Vue项目中数据可视化的终极利器 jsWebControl解决海康视频插件窗口遮挡层级问题 es6划重点 - IT-caijw - 博客园 Promise原理讲解 async+await应用(异步回调解决方案) - IT-caijw - 博客园 echarts 的日常(教学篇) - IT-caijw - 博客园 angularjs 基础 ## HBuilder MUI开发时genymotion模拟器连接Hbuilder vue07-router 路由 vue05-REST 请求 vue06-single-file-component vue04-components vue03-directives 指令
vue02-filters-computer
IT-caijw · 2018-02-22 · via 博客园 - IT-caijw

vue02-filters-computer

filters: 自动data里面的数据查找
computer: 重新计算data里面的数据

html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>

</head>
<body>
  <h1>My App</h1>
  <div id="app"></div>

  <script src="https://unpkg.com/vue"></script>
  <script src="./main.js"></script>
</body>
</html>

main.js

const app = new Vue({
	el : '#app',
	data : {
		bobby: {
			first : 'bobby',
			last : 'banne',
			age : 25
		},
		john : {
			first : 'john',
			last : 'Baby',
			age : 25
		}
	},
	//自动计算
	computed : {
		bobbyFullName(){
			return `${this.bobby.first} ${this.bobby.last}`;
		},
		johnFullName(){
			return `${this.john.first} ${this.john.last}`;
		},
		bobbyAge(){
			return this.bobby.age;
		}
	},
	//查找
	filters: {
	    ageInOneYear(age) {
	      return age + 1;
	    },
	    fullName(value) {
	      return `${value.last}, ${value.first}`;
	    }
	},
	template : `<div>
		<h2>Name: {{bobbyFullName}}</h2>
		<h2>age: {{bobbyAge}}</h2>
		<h2>Name: {{john | fullName}}</h2>
	</div>`
})