当前位置:网站首页>Atguigu---- filter
Atguigu---- filter
2022-06-22 02:07:00 【Xiaobai learns programming together】

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title> filter </title>
<script type="text/javascript" src="../js/vue.js"></script>
<script type="text/javascript" src="../js/dayjs.min.js"></script>
</head>
<body>
<!-- filter : Definition : Format the data to be displayed before displaying it ( It is suitable for some simple logical processing ). grammar : 1. Registration filter :Vue.filter(name,callback) or new Vue{filters:{}} 2. Use filters :{
{ xxx | Filter name }} or v-bind: attribute = "xxx | Filter name " remarks : 1. The filter can also receive additional parameters 、 Multiple filters can also be connected in series 2. Did not change the original data , Is to generate new corresponding data -->
<!-- Prepare a container -->
<div id="root">
<h2> Displays the formatted time </h2>
<!-- Calculate the property implementation -->
<h3> Now it is :{
{fmtTime}}</h3>
<!-- methods Realization -->
<h3> Now it is :{
{getFmtTime()}}</h3>
<!-- Filter implementation -->
<h3> Now it is :{
{time | timeFormater}}</h3>
<!-- Filter implementation ( The ginseng ) -->
<h3> Now it is :{
{time | timeFormater('YYYY_MM_DD') | mySlice}}</h3>
<h3 :x="msg | mySlice"> Silicon Valley </h3>
</div>
<div id="root2">
<h2>{
{msg | mySlice}}</h2>
</div>
</body>
<script type="text/javascript"> Vue.config.productionTip = false // Global filter Vue.filter('mySlice',function(value){
return value.slice(0,4) }) new Vue({
el:'#root', data:{
time:1621561377603, // Time stamp msg:' Hello , Silicon Valley ' }, computed: {
fmtTime(){
return dayjs(this.time).format('YYYY year MM month DD Japan HH:mm:ss') } }, methods: {
getFmtTime(){
return dayjs(this.time).format('YYYY year MM month DD Japan HH:mm:ss') } }, // Local filter filters:{
timeFormater(value,str='YYYY year MM month DD Japan HH:mm:ss'){
// console.log('@',value) return dayjs(value).format(str) } } }) new Vue({
el:'#root2', data:{
msg:'hello,atguigu!' } }) </script>
</html>
边栏推荐
- 微信小程序影视评论交流平台系统毕业设计毕设(4)开题报告
- Dachang NVIDIA face test questions sorting 123
- 机器学习编译第1讲:机器学习编译概述
- Android使用SQL数据库进行登录功能时报错Attempt to invoke virtual method ' ' on a null object reference
- LeetCode 41 - 45 动态规划专题
- latex关于&的报错问题及表格排版问题
- atguigu----收集表单数据
- Mathematical knowledge in the first round of noip preliminary round csp-j1 csp-s1 Xinjiang Olympic Games (II)
- excel常用快捷键excel快捷键汇总
- Flexer series: indexedstack in Flexer
猜你喜欢

测试apk-异常管控Sensor攻击者开发

Mysql database easy learning 09 - commonly used by data analysts: multi table query of data query language DQL

Lianfa science and technology -- Introduction to Lianfa science and technology ++ attached

微信小程序影视评论交流平台系统毕业设计毕设(4)开题报告
![[chapter 02 weight adaptive image denoising technology based on Morphology - full system matlab intelligent driving in-depth learning]](/img/65/c9ba18ffd37f84c3ca399507625c90.png)
[chapter 02 weight adaptive image denoising technology based on Morphology - full system matlab intelligent driving in-depth learning]

Chapter 12 panoramic image mosaic based on block matching -- Application of MATLAB in-depth learning and actual combat image processing
![[Chapter 10: a website digital verification code recognition based on moment invariants matlab deep learning practical application case]](/img/19/867c03660cb9127dbb967402d8ca8f.png)
[Chapter 10: a website digital verification code recognition based on moment invariants matlab deep learning practical application case]

Completion of graduation design of wechat small program film and television review and exchange platform system (4) opening report

Wechat applet Film & TV Review Exchange Platform System Graduation Design (4) Rapport d'ouverture

GAMES-101-个人总结归纳-Transformation
随机推荐
Mysql database easy to learn 07 - select statement writing order and execution order
es-object vs nested vs has_child and has_parent
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(二)
[chapter 07 face QR code recognition based on principal component analysis matlab deep learning practical case]
微信小程序影视评论交流平台系统毕业设计毕设(2)小程序功能
What does the maturity and redemption time of financial products mean?
LeetCode+ 46 - 50
2021 csp-j1 csp-s1 first round preliminary round related questions and videos
MBA-day23 至多至少问题-练习题
excel常用快捷键excel快捷键汇总
Games-101-personal summary shading
Preliminary competition of noip improvement group III. problem solving exercise set noip1995-noip2018
软件测试工程师面试接口测试常见问题
LeetCode 41 - 45 动态规划专题
微信小程序影视评论交流平台系统毕业设计毕设(4)开题报告
学习过的课程
1277_FreeRTOS中vTaskDelay的实现分析
NOIP初赛 CSP-J1 CSP-S1 第1轮 初赛 信奥中的数学知识(一)
acwing 836. 合并集合 (并查集)
测试apk-异常管控Sensor攻击者开发