標籤:sse block contract style 箭頭 alt row 注意 indicator
1. return false ES6函數的擴充:箭頭函數 數組 arr.map() arr.filter()
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title></head><body><script> var o = { num (a) { if(a>4){ a=1; return false; // return false 表示 不執行了。 } a=10; return a; } } console.log(o.num(21)); // false var arr = [1,2,3]; console.log(arr.map(x => x * x)); // 相當於for迴圈 console.log(arr.filter(x => x > 1)); // 過濾條件 把x>1的過濾出來 【2,3】 //函數的擴充,箭頭函數 var f = x=>x*12; console.log(f(2)); var f2 = ()=>10; console.log(f2()); var f3 = (a,b)=>a+b; console.log(f3(4, 5));</script></body></html>View Code
2.ppmoney Test.vue TestOne.vue 路由傳值等
Test.vue
<template> {{mes}} <button @click="test">btn</button> <group> <x-input title=‘名字‘ placeholder=‘請輸入你的名字‘ :value.sync="name"> </x-input> <x-input title=‘愛好‘ placeholder=‘請輸入你的愛好‘ :value.sync="hobby"> </x-input> <x-button type="primary" @click="goToTestOne">立即申請</x-button> </group> <div> <img :src="arrowSrc" alt=""> <p :class="{‘red-font‘:isRed}">紅色字型</p> </div></template><style> .red-font{color:red;}</style><script> export default{ components: { Group: require(‘vux-components/group‘), XInput: require(‘vux-components/x-input‘), XButton: require(‘vux-components/x-button‘) }, data () { return { name: ‘‘, hobby: ‘‘, mes: ‘123234‘, arrowSrc: require(‘../assets/images/helper/help-arrow-down.png‘), isRed: true } }, methods: { test () {// this.$data.mes = ‘456‘ this.$set(‘mes‘, ‘中國‘) // 兩種寫法 }, goToTestOne () {// this.$router.go(‘/testOne‘) this.$router.go({path: ‘/testOne‘, query: {name: this.$data.name, hobby: this.$data.hobby}}) } } }</script>Test.vue
TestOne.vue
<template> {{mes}} <p>{{name}}</p> <p>{{hobby}}</p></template><script> export default{ data () { return { name: ‘‘, hobby: ‘‘, mes: ‘123234‘ } }, created () { // 用 create () this.$data.name = this.$route.query.name // 注意這裡是 $route 沒有‘r‘ this.$data.hobby = this.$route.query.hobby } }</script>TestOne.vue
ppmoney 總結二