[TOC]
#### Vue表達式的應用
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/index.css" />
<script type="text/javascript" src="js/vue.js"></script>
<title>表達式</title>
<style>
.class1{
color: red;
}
.class2{
color: green;
}
</style>
</head>
<body>
<div id="xy">
{{n+1}}
<!--屬性中使用表達式-->
<h1 :class="'class'+n">{{title}}</h1>
<input type="radio" value="1" v-model="n" />紅色
<input type="radio" value="2" v-model="n" />綠色
</div>
<script type="text/javascript">
var app = new Vue({
el: "#xy",
data: {
title: "hello Vue!",
n: 1,
}
});
</script>
</body>
</html>
#### 計算屬性computed實例講解
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/index.css" />
<script type="text/javascript" src="js/vue.js"></script>
<title>computed</title>
</head>
<body>
<div id="xy">
<!--計算輸入兩個內容的和-->
n1:<input v-model="n1" type="text"/>+
n2:<input v-model="n2" type="text"/>=
<input v-model="sum" type="text"/>
</div>
<script type="text/javascript">
var app = new Vue({
el: "#xy",
computed:{
sum:function(){
return this.n1*1 + this.n2*1;
}
},
data: {
n1: 0,
n2:0,
}
});
</script>
</body>
</html>
#### class中應用表達式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="vue.js"></script>
<script src="node_modules/axios/dist/axios.js"></script>
<script src="node_modules/lodash/lodash.js"></script>
</head>
<body>
<style>
.success {
color: green;
}
.error {
color: red;
}
</style>
<div id="hdcms">
<li v-for="v in news">
<!--class中應用表達式-->
<span :class="v.status?'success':'error'">{{v.title}}</span>
<button v-on:click="changeStatus(v,false)" v-if="v.status">刪除</button>
<button v-on:click="changeStatus(v,true)" v-if="!v.status">恢復</button>
</li>
</div>
<script>
var app = new Vue({
el: '#hdcms',
methods: {
changeStatus: function (item, status) {
item.status = status;
}
},
data: {
news: [
{title: '后盾人', status: true},
{title: 'houdunren.com', status: true},
]
}
});
</script>
</body>
</html>
#### 多種方式使用vue控制style樣式屬性
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="vue.js"></script>
<script src="node_modules/axios/dist/axios.js"></script>
<script src="node_modules/lodash/lodash.js"></script>
</head>
<body>
<div id="hdcms">
<h1 :style="{color:'red',fontSize:size+'px'}">后盾人</h1>
<h2 :style="style">后盾人</h2>
<h3 :style="[hdcms]">houdunren.com</h3>
<input type="number" v-model="size">
</div>
<script>
var app = new Vue({
el: '#hdcms',
data: {
red: 'green',
size: 16,
style: {
color: 'blue'
},
hdcms:{
color:'yellow',
backgroundColor:'blue'
}
}
});
</script>
</body>
</html>
- html&jquery網頁特效
- 標簽分類及特點
- 關于文字標簽
- 網頁定時跳轉
- css透明度和插件
- 0.前端常用工具
- 1.tab切換效果
- 2.tab切換效果多個代碼復用
- 3.百度新聞導航條效果
- 4.解決鼠標移入過快的問題
- 5.滾動條位置
- 6.元素尺寸
- 7.全選反選操作
- 8.固定定位
- 9.開關效果
- 10.節點操作
- 11.仿小米商品展示效果
- 12.仿小米商品展示效果復用
- 13.固定導航欄效果
- 14.凡客輪播圖效果
- 15.頂部下滑廣告效果
- 16.京東左右滑動輪播圖
- 17.京東左右滑動無縫輪播圖
- 18.選擇器
- 19.篩選
- 20.開關效果
- 21.滑動效果
- 22.小米商品效果css實現
- 23.元素水平垂直居中
- laravel5.6
- LARAVEL 介紹&安裝
- javascript & css 腳手架
- php常用工具類
- 安裝laravel-ide-helper增強代碼提示
- 使用migration創建表和數據填充
- 解決mysql5.7以下laravel不能執行數據遷移的問題
- 路由
- 登陸操作自定義模型
- 使用中間件middleware進行登錄權限驗證
- 進行表單驗證處理
- 使用laracasts-flash定制消息提示
- 資源路由
- 寶塔面板安裝fileinfo擴展
- laravel上傳處理與使用hdjs快速實現前端上傳組件
- thinkphp
- phpstorm
- phpstorm安裝插件
- 定義快捷鍵
- 關閉提示
- 將代碼實時同步到遠程服務器
- sublime
- composer
- git使用
- git安裝和配置作者信息
- git新建項目和維護項目
- git日志操作
- git別名操作
- git分支操作
- git生成發布壓縮包
- git系統別名
- gitrebase操作
- 使用SSH與GITHUB遠程服務器進行無密碼連接
- 本地版本庫主動使用remote與遠程GITHUB進行關聯
- 本地分支與GITHUB遠程分支同步
- 項目實戰-新入職員工參與項目開發時分支使用
- 自動部署
- ios開發
- linux
- 1.centos6.5 mysql忘記登入密碼
- html5
- 標簽
- 表單
- 音頻與視頻
- webstorage儲存
- canvas
- css3
- 01.CSS3布局
- 02.transition動畫
- 03.animation動畫
- 04.flex彈性盒模型
- Less
- gulpjs
- es6
- ES6模塊化
- let和const命令
- ES6函數擴展&解構賦值
- JavaScript之數據遍歷
- class類
- Set和Map數據結構
- Vue
- 1.創建第一個應用
- 2.屬性動態綁定
- 3.表達式
- 4.解決phpstorm不識別ECMASCRIPT6語法的問題
- 5.watch監聽屬性
- 6.使用object與array控制class
- 7.條件渲染
- 8.循環
- 9.變異方法
- 10.事件
- 11.表單
- 12.組件
- 13.css過渡動
- 14.js庫控制vue過渡動作
- 15.自定義指令directive
- 16.使用vue-cli初始化單頁面應用
- 17.Vue-router路由
- 18.vuex
- 19.vue-cli
- webpack
- zanui
- nodejs