
vue计算属性和监听器区别
发布日期:2021-05-08 00:22:17
浏览次数:19
分类:精选文章
本文共 2261 字,大约阅读时间需要 7 分钟。
?????????????????
?Vue.js?????????????????????????????????????????????????????????????????????
??????????????
?????Computed Property???????Watcher??Vue.js??????????
????
- ???????????????????????????????????????
- ??????????
computed
?????????{}
??????????methods
???????????????????????? - ?????????????????????????????????????????????
????
-??????????????????????????????????????? -?????????????????????????????????????????????????????????
?Element UI???????????????????????????????????????????????????????????
????
watch: { total() { if (this.total === (this.currentPage - 1) * this.pageSize && this.total !== 0) { this.currentPage -= 1; getDiscountList(this); // ?????? } }}
??????????????
??????????????????????????????????????
computed: { limitData() { let data = [...this.table1Datas]; return data; }, dataWithPage() { const data = this.limitData; const start = this.current * this.size - this.size; const end = start + this.size; return [...data].slice(start, end); }},
????????????????
??????????????????????????????????
?????????????
data() { return { // ??????... data: { pensionBase: '', // ????? pensionPer: '0.08', // ????? // ????????... } };},computed: { newPensionBase() { return this.data.pensionPer * this.data.basicSalary; }, // ??????????...},watch: { // ?????????...},
?????????
computed: { newaccumulationFundPer() { let basicSalary = this.data.basicSalary; if (basicSalary != null) { switch (true) { case basicSalary < 5000: return 0; case basicSalary >= 5000 && basicSalary < 80000: return 0.03; case basicSalary >= 8000 && basicSalary <= 17000: return 0.1; case basicSalary > 17000 && basicSalary <= 30000: return 0.2; case basicSalary > 30000 && basicSalary <= 40000: return 0.25; case basicSalary > 40000 && basicSalary <= 60000: return 0.3; default: return 0.45; } } return 0; }},
??????
?????????????????????????????????????????????????????????????????????????????
????
??????????Vue.js???????????????????????????????????????????????????????????????????????????????????
发表评论
最新留言
关注你微信了!
[***.104.42.241]2025年04月30日 21时37分48秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
leetcode题解153-寻找旋转排序数组的最小值
2025-04-05
leetcode题解167-两数之和 II - 输入有序数组
2025-04-05
leetcode题解172-阶乘后的零
2025-04-05
leetcode题解173-二叉搜索树迭代器
2025-04-05
leetcode题解179-最大数
2025-04-05
leetcode题解189-旋转数组
2025-04-05
leetcode题解191-位1的个数
2025-04-05
leetcode题解20-有效的括号
2025-04-05
leetcode题解200-岛屿数量
2025-04-05
leetcode题解206-反转链表
2025-04-05
leetcode题解227-基本计算器 II
2025-04-05
leetcode题解236-二叉树的最近公共祖先
2025-04-05
leetcode题解25-K个一组翻转链表
2025-04-05
leetcode题解279-完全平方数
2025-04-05
leetcode题解3-无重复字符的最长子串
2025-04-05
leetcode题解34-在排序数组中查找元素的第一个和最后一个位置
2025-04-05
leetcode题解347-前 K 个高频元素
2025-04-05
leetcode题解4-寻找两个正序数组的中位数
2025-04-05
leetcode题解41-缺失的第一个正数原来如此简单
2025-04-05
leetcode题解434-字符串中的单词数(双指针经典)
2025-04-05