软糖

Candy


  • Home

  • Archives

  • Tags

  • Search
close
软糖

Vue2-2 component

Posted on 2018-04-07 |

Simple Component

1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<body>
<div id="root">
<task></task>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./order.js"></script>
</body>
</html>
1
2
3
4
5
6
7
Vue.component('task', {
template: '<li>Foobar</li>'
})
new Vue({
el: '#root',
})

Sub component

1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE html>
<html>
<body>
<div id="root">
<task-list title="my todo list"></task-list>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="./order.js"></script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Vue.component('task-list', {
props: ['title'],
template: `
<div v-show="isVisible">
<div>{{ title }}</div>
<task v-for="t in tasks">{{ t.task }}</task>
<button type="button" @click="hideModel">close</button>
</div>
`,
data() {
return {
isVisible: true,
tasks: [
{ task: 'Go to the store', complete: true },
{ task: 'Go to the email', complete: false },
]
}
},
methods: {
hideModel() {
this.isVisible = false
}
},
})
Vue.component('task', {
template: '<li><slot></slot></li>',
})
new Vue({
el: '#root',
})
软糖

Vue2-1 basic

Posted on 2018-04-07 |

Basic Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<body>
<div id="root">
<ul>
<li v-for="n in names" v-text="n"></li>
</ul>
<input id="input" :type="inputType" v-model="newName"/>
<button @click="addName">{{ label }}</button>
<h1 v-text="reversedMessage"></h1>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
new Vue({
el: '#root',
data: {
label: 'Add Name',
inputType: 'text',
newName: '',
names: ['Alice', 'Bob', 'Jane', 'Jack'],
message: 'Hello World'
},
methods: {
addName() {
this.names.push(this.newName)
this.newName = ''
}
},
computed: {
reversedMessage() {
return this.message.split('').reverse().join('')
}
}
})
</script>
</body>
</html>
软糖

rabbit

Posted on 2018-03-22 |

2018年03月22日

小小罗与爸爸武道比试
爸爸:“看我猴拳,鹤拳,虎拳,呼呼呼”
小小罗手做兔耳,同时喊道:“看我兔拳,小兔子乖乖”
画风突变…

软糖

lunch

Posted on 2018-02-12 |

2018年02月12日

某顿饭桌上,我说: “撑死了,我吃不下了”
小小罗眨眨眼睛: “来,给我点,我帮你 da(处) shi(理)”

软糖

phone

Posted on 2017-12-06 |

2017年12月06日

小小罗不小心把手机掉到地上
看到手机坏了,然后郑重其事的说,
看来我可以打个洞去姥姥家了。

这是女儿一直对facetime视频电话的幻想

软糖

brave

Posted on 2017-12-03 |

2017年12月03日

你是我的爸爸啊,你应该勇敢,痛,你怎么能说呢?

软糖

turtle

Posted on 2017-11-25 |

2017年11月25日

妈妈后背受伤,结痂后说像乌龟壳,让女儿摸摸看。
“女儿,像乌龟不” 妈妈问
女儿开心的说,“像,来把头缩回去看看”

软糖

大爷

Posted on 2017-11-13 |

2017年11月14日

女儿对问妈妈 “什么是大爷啊”
蹦豆说 “就是爸爸的哥哥”

“哦”, 女儿又问, “那妈妈有大爷吗?”
“没有”

“那我当你大爷吧”
这就是女儿体谅别人的可爱方式

软糖

口头禅

Posted on 2017-11-13 |

2017年11月13日

最近女儿有句口头禅,而且我觉得很无敌。
可以说我和她妈妈,罗蹦豆,对这句没有任何招架之力。

只要妈妈爸爸好就行了

软糖

Haskell 8 Input and Output

Posted on 2017-11-13 |

Taking Notes from http://learnyouahaskell.com

IO

  • 你能把 I/O action 想成是一个长了脚的盒子,它会跑到真实世界中替你做某些事
  • 打开盒子的唯一办法就是用 <-
  • 一个 I/O action 会在我们把它绑定到 main 这个名字并且运行程序的时候触发
  • do 表示法将所有 I/O action 绑成一个

Hello World

hello world 来的晚了点 :)

1
main = putStrLn "hello, world"
Read more »
1234…6
Steven Zhang

Steven Zhang

Java, Haskell and Architecture

57 posts
23 tags
GitHub
© 2016 - 2020 Steven Zhang
Powered by Hexo
Theme - NexT.Mist