
但因為要手動翻譯其他語系,打字實在很麻煩,以我來說,大概只有英文是比較知道如何下手的,但日文跟簡體中文呢?一直去找 google translate 也挺麻煩的,還好 google spreadsheets 有現成的函式可以幫我做到,看到這個功能眼淚都要掉出來了,因為當我有上百個字詞要翻譯的時候,根本不可能這麼“人工”,就算透過翻譯出來的英文沒有很準確,但至少我可以只挑我要修改的去修正就行。


<!--準備 CardComponent 的 Template--> <script type="x-template" id="cards-tmp"> <div id="cards-tmp"> <div class="card" v-for="card in cards"> <h2>{{ card.title }}</h2> <p>{{ card.description }}</p> <a href="#" v-on:click.prevent="openModal(card.id)">read more</a> </div> </script> <div id="app"> <h1>Vue App Example</h1> <div> <card-comp :cards="cardOriginal"></card-comp> </div> </div>
// make an component var cardComponent = Vue.extend({ // 指定是哪個 Element template: '#cards-tmp', // what props you want to accept. props: ['cards'], methods: { openModal: function(id){ alert(id); } } }); new Vue({ el: '#app', components: { // register name is card-comp 'card-comp': cardComponent }, data: { cardOriginal: [ { id: 123, title: 'Hello Vue', description: 'Good Morning!' }, { id: 123, title: 'Hello Vue', description: 'Good Morning!' } ] } });
<script src="/assets/js/vue.min.js"></script> <script src="/assets/js/vue-avatar.min.js"></script>
new Vue({
el: '#app',
components: {
'avatar': Avatar.Avatar
},
// 來一點示範的資料
data: {
username1: 'Win.Wu 吳穎穎',
username2: 'YIYING WU',
username: "hello world",
},
....
<avatar :username="username1" :size="40"></avatar> <avatar :username="username2" :size="40"></avatar> <avatar :username="username" :size="40"></avatar>

var vm = new Vue({ el: '#app', data: { name: 'winwu', width: 900, height: 500, barColor: 'red', barHeight: 30, barXOffset: 10, dataset: [30, 20, 45, 12, 21] }, // https://vuejs.org/api/#Options-Lifecycle-Hooks init: function() { // init 這時候還沒有觀察到 data observation, event, watcher... console.log('init: my name is ' + this.name); }, created: function() { /* data observation, * computed properties, * methods, * watch/event callbacks. * 在這個階段完成 * 但,$el 這時候還沒有好,(DOM 的解析還沒開始) */ console.log('creadted: my name is ' + this.name); }, beforeCompile: function() { // 我也不曉得什麼時候會呼叫到這裡 console.log('beforeCompile: my name is ' + this.name); }, compiled: function() { console.log('compiled: my name is ' + this.name); }, ready: function() { // 在 vm.$el 插入 DOM 時呼叫。 console.log('ready: my name is ' + this.name); }, attached: function() { console.log('attached'); }, beforeDestroy: function() { // 我也不曉得什麼時候會呼叫到這裡 console.log('beforeDestroy'); }, destroyed : function() { console.log('destroyed: my name is ' + this.name); } }); // call destroy, 才會觸發 destroyed func. 這時候長條圖已經不會隨著 data 連動 vm.$destroy(); // 第一個參數為是否 remove,若為 true,所有 DOM 的關聯會刪掉。 // vm.$destroy(true);這是 log 結果:
init: my name is undefined 01.js:29 creadted: my name is winwu 01.js:33 beforeCompile: my name is winwu 01.js:36 compiled: my name is winwu 01.js:43 attached 01.js:40 ready: my name is winwu 01.js:46 beforeDestroy 01.js:49 destroyed: my name is winwu// vm.$destroy(true);
{{ variable }} 這樣的 expression 竟然怎麼樣都不顯示在畫面上,原來是因為我的 view 是 hbs (handlebarsjs) (因為是 express 的專案...),所以這 {{ }} 這個分隔符號會先被 handlebarsjs 吃掉,以至於我的變數反而沒被 vue 辨識。samsung edge plus 6.^0.26.1
要在畫面一進來 focus multiselect 的方式: 參考: https://jsfiddle.net/shentao/mnphdt2g/ 主要就是在 multiselect 的 tag 加上 ref (例如: my_multiselect), 另外在 mounted...