1、兄弟組件交互

demo.html
~~~
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>兄弟組件交互</title>
<script src="js/vue.min.js"></script>
<style>
.green{background-color: green;-webkit-transition: all .5s ease;transition: all .5s ease;}
.greenActive{background-color: #f00;}
</style>
</head>
<body>
<div id="app">
<Hello ref="hello"></Hello>
<World title="this is world.." v-bind:style="worldStyle"></World>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
worldStyle: {
width: '100px',
height: '100px',
border: '1px solid #ddd',
marginTop: '10px'
}
},
components: {
'Hello': {
template: '<div v-bind:style="helloStyle"><p v-on:click="clickFn">{{ say }}</p></div>',
data: function() {
return {
helloStyle: {
width: '200px',
height: '200px',
backgroundColor: '#ccc'
},
say: 'hello'
};
},
methods: {
clickFn: function() {
this.say = 'hello';
app.$children[1].$data.classA = 'green greenActive'
}
}
},
'World': {
props: {
title: String
},
data: function() {
return {
classA: 'green'
};
},
template: '<div v-bind:class="[classA]">{{ title }}<button type="button" v-on:click="clickFn">world</button></div>',
methods: {
clickFn: function() {
this.classA = 'green';
app.$children[0].$data.say = 123;
// app.$refs.hello.say = 333; 使用ref來實現
}
}
}
}
});
</script>
</body>
</html>
~~~
上述無疑就是VUE的核心所在,MVVM模式

在DOM與JS之間加個中間件VUE,使得DOM與JS的交互更便捷。。
寫到這里突然感覺寫不下去了,畢竟沒有在項目中使用,而且VUE API中的東西稍多,一一介紹不如看VUE API。。
只想說在合適的地方使用VUE,不要偏激。。
2、slot卡槽

demo.html
~~~
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>slot</title>
<script src="js/vue.min.js"></script>
</head>
<body>
<div id="demo">
<blog-post>
<slot name="header"></slot>
<p slot="footer">
Copyright 2016 Evan You
</p>
<p>main</p>
</blog-post>
</div>
<script>
Vue.component('blog-post', {
render: function (createElement) {
var header = this.$slots.header;
var body = this.$slots.default;
var footer = this.$slots.footer;
return createElement('div', [
createElement('header', '123'),
createElement('main', body),
createElement('footer', footer)
])
}
})
new Vue({
el: '#demo'
});
</script>
</body>
</html>
~~~
- 事件
- mouse縮放與拖動
- drag拖動
- 事件兼容
- animation/transition
- canvas
- 改變圖片顏色
- html轉圖片
- 視頻操作
- 圖片縮放、水印、放大鏡
- 虛線
- 圓環進度條
- 形狀事件
- 圓角矩形
- 繪制注意
- arcTo與貝塞爾
- 橢圓及橢圓進度
- 五角星進度
- 常用圖形
- 計算顯示文本寬度
- 算法
- 幾何算法
- 地圖應用相關
- 運行符
- web安全
- 新窗口打開
- xss
- 分享交流
- php環境搭建及xhr交互
- node環境搭建及xhr交互
- node之socketio
- svg之入門介紹
- svg動畫
- vue之搜索聯想
- vue之登錄和echarts
- vue之組件交互與slot
- vue之loading
- vue之上傳進度
- webpack及cli
- 開發技巧
- 常用
- 移動端
- 錯誤處理
- 預加載
- 代理判斷
- 數組擴展
- 對象擴展
- 字符串擴展
- 語音播報
- 收集
- 文章/日記
- 框架/庫/插件
- 工具
- 學習網站
- 專業術語
- 正則
- 常用驗證
- 方法基礎
- es6擴展
- 深入實踐
- 快捷使用
- html
- css
- http協議
- http
- https
- socket
- 地圖/圖表
- mapbox
- echarts
- arcgis
- MapView及事件
- 添加WMS/WMTS層
- 增刪點線面
- 入門使用
- popup彈層
- 大數據處理
- 批量點
- 批量線
- 在線繪制
- GraphicLayer顯示/隱藏
- 動態改變位置
- 去除版權信息
- 添加控件
- Symbol
- 自定義path標記
- 圖片標記
- 文本標記
- 旋轉
- UI
- 自定義
- 3D地圖
- 創建實例
- basemap
- 底圖切換
- 自定義底圖
- 中心和范圍
- pupup彈層更新
- 坐標轉換
- 方向線
- leaflet
- amap
- 框架/類庫/腳手架
- vue
- 常見問題
- 組件框架
- vue-router
- 命名視圖
- url參數映射到prop
- sublime支持
- 隨手記
- 常用功能
- threejs
- 常用效果
- 其他特效
- requirejs
- 簡單使用
- jquery
- 方法擴展
- 使用筆記
- 組件擴展
- react
- 黨見問題
- 學習筆記
- 學習筆記-進階
- react-redux
- react-router
- redux
- 其他模塊說明
- 組件框架
- sublime支持
- gulp
- 安裝使用
- js壓縮
- css壓縮
- 組合使用
- copy文件
- 項目使用
- protobuf
- 入門
- layui
- 登錄驗證
- laydate
- 安裝工具
- yarn
- reactNative
- 入門介紹
- vueNative
- 入門介紹
- 版本控制
- git常用
- git擴展
- git問題
- git其他
- git擴展2
- 編輯器
- vscode
- atom
- webstorm
- 插件
- clipboard
- 奇淫巧技
- js
- 個性打印
- css
- 濾鏡效果
- 文本省略
- 當前色
- 新特性
- 花樣邊框效果
- 波紋效果
- 個性placeholder
- 偽元素內容
- 容器居中
- 知識點
- js
- 遞歸
- 沙箱
- 內存泄漏
- es6語法
- 變量介紹
- FileRead
- ajax
- web存儲
- css
- rem布局