中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站開發(fā)職業(yè)規(guī)劃實(shí)施網(wǎng)站模板之家

網(wǎng)站開發(fā)職業(yè)規(guī)劃實(shí)施,網(wǎng)站模板之家,免費(fèi)服務(wù)器安全軟件,公眾號怎么開通申請基本功能: 顯示所有待辦列表(點(diǎn)擊不同的文本進(jìn)行顯示) 沒完成的待辦 已完成的待辦 新建待辦test 清除待辦foo 代碼js文件: //index.js //獲取應(yīng)用實(shí)例 const app getApp(); Page({data: {todo: ,todos: [{"id": 1474…

基本功能:

顯示所有待辦列表(點(diǎn)擊不同的文本進(jìn)行顯示)

沒完成的待辦

已完成的待辦

新建待辦test

清除待辦foo

代碼js文件:

//index.js
//獲取應(yīng)用實(shí)例
const app = getApp();
Page({data: {todo: '',todos: [{"id": 1474894720002,"todo": "foo","completed": false},{"id": 1474894720922,"todo": "bar","completed": true},{"id": 1474894723594,"todo": "baz","completed": false}],filterTodos: [],filter: 'all',activeCount: 0,},bindTodoInput(e) {this.setData({todo: e.detail.value});},saveTodo(e) {if (this.data.todo.trim().length === 0) {return;}const newTodo = {id: new Date().getTime(),todo: this.data.todo,completed: false,};this.setData({todo: '',todos: this.data.todos.concat(newTodo),filterTodos: this.data.filterTodos.concat(newTodo), activeCount: this.data.activeCount + 1,});},todoFilter(filter, todos) {return filter === 'all' ? todos: todos.filter(x => x.completed === (filter !== 'active'));},toggleTodo(e) {const { todoId } = e.currentTarget.dataset;const { filter, activeCount } = this.data;let { todos } = this.data;let completed = false;todos = todos.map(todo => {if (Number(todoId) === todo.id) {todo.completed = !todo.completed;completed = todo.completed;}return todo;});const filterTodos = this.todoFilter(filter, todos);this.setData({todos,filterTodos,activeCount: completed ? activeCount - 1 : activeCount + 1,});},useFilter(e) {const { filter } = e.currentTarget.dataset;const { todos } = this.data;const filterTodos = this.todoFilter(filter, todos);this.setData({filter,filterTodos,});},clearCompleted() {const { filter } = this.data;let { todos } = this.data;todos = todos.filter(x => !x.completed);this.setData({todos,filterTodos: this.todoFilter(filter, todos),});},todoDel(e) {const { todoId } = e.currentTarget.dataset;const { filter, activeCount } = this.data;let { todos } = this.data;const todo = todos.find(x => Number(todoId) === x.id);todos = todos.filter(x => Number(todoId) !== x.id);this.setData({todos,filterTodos: this.todoFilter(filter, todos),activeCount: todo.completed ? activeCount : activeCount - 1,});},onLoad() {console.log('onLoad');const that = this;const activeCount = this.data.todos.map(x => x.completed ? 0 : 1).reduce((a, b) => a + b, 0);that.setData({activeCount,filterTodos: this.data.todos});}
});

wxml:

<scroll-view class="container" scroll-y="true"><view class="todo"><input class="new-todo"placeholder="添加待辦列表"value="{{todo}}"bindinput="bindTodoInput"/><button type="primary" class="new-todo-save" bindtap="saveTodo">→</button></view><view class="todo-footer"><text class="total">{{activeCount}} 個待辦</text><view class="filter"><text bindtap="useFilter"data-filter="all"class="{{ filter === 'all' ? 'filter-item filter-active' : 'filter-item'}}">所有</text><text bindtap="useFilter"data-filter="active"class="{{ filter === 'active' ? 'filter-item filter-active' : 'filter-item'}}"       >待辦</text><text bindtap="useFilter"data-filter="completed"class="{{ filter === 'completed' ? 'filter-item filter-active' : 'filter-item'}}">已完成</text></view><text wx:if="{{ todos.length - activeCount != 0 }}" class="clear" bindtap="clearCompleted">清除完成項(xiàng)</text><text wx:else class="clear-empty"></text></view><view class="todo-list"><view class="todo-item" wx:for="{{filterTodos}}" wx:key="id"><icon bindtap="toggleTodo" class="todo-check"data-todo-id="{{item.id}}"type="{{ item.completed ? 'success_circle' : 'circle'}}" /><text class="{{ item.completed ? 'todo-content todo-completed' : 'todo-content'}}">{{item.todo}}</text><icon bindtap="todoDel" class="todo-del" data-todo-id="{{item.id}}" type="cancel" /></view></view>
</scroll-view>

wxss:

/**index.wxss**/
.todo {margin: 20rpx;display: flex;align-items: center;background: #F5F5F5;height: 70rpx;
}.new-todo {border: none;font-style: italic;width: 100%;
}.new-todo-save {font-size: 28rpx
}.todo-list {margin: 20rpx;display: flex;flex-direction: column;flex-grow: 2;
}.todo-item {display: flex;height: 80rpx;position: relative;
}.todo-check {margin-top: -6rpx;
}.todo-del {margin-top: -6rpx;position: absolute;right: 20rpx;
}.todo-content {margin-left: 20rpx;
}.todo-completed {color: #d9d9d9;text-decoration: line-through;
}.todo-footer {display: flex;align-items: center;justify-content: space-between;height: 80rpx;margin-left: 20rpx;margin-right: 20rpx;font-size: 24rpx;
}.filter {display: flex;flex-direction: row;
}.filter-item {margin-left: 10rpx;padding: 6rpx 14rpx;
}.filter-active {border: 1px solid;border-color: rgba(175, 47, 47, 0.2);
}.clear-empty {width: 120rpx;height: 24rpx;
}

http://m.risenshineclean.com/news/64961.html

相關(guān)文章:

  • 做營銷網(wǎng)站設(shè)計(jì)百度免費(fèi)咨詢
  • 河北住房和城鄉(xiāng)建設(shè)局網(wǎng)站首頁百度免費(fèi)推廣
  • 東莞推廣網(wǎng)站排名seo研究中心官網(wǎng)
  • 教育行業(yè)網(wǎng)站建設(shè)代做seo關(guān)鍵詞排名
  • 正確的企業(yè)郵箱格式seo百度發(fā)包工具
  • 網(wǎng)站備案 怎么建站廣州關(guān)鍵詞排名推廣
  • 電商網(wǎng)站怎么做權(quán)限控制潮州網(wǎng)絡(luò)推廣
  • 佛山智唯網(wǎng)站建設(shè)uc瀏覽網(wǎng)頁版進(jìn)入
  • 網(wǎng)站建設(shè)推廣怎么做抖音seo怎么做
  • 域名注冊好了如何做網(wǎng)站百度快速優(yōu)化推廣
  • 溧陽網(wǎng)站建設(shè)哪家好長沙百度快速排名
  • 那個網(wǎng)站可以做數(shù)學(xué)題賺錢深圳整合營銷
  • 鄭州網(wǎng)站推廣策世界杯32強(qiáng)排名
  • java網(wǎng)站開發(fā)需要什么軟件關(guān)鍵詞推廣軟件
  • 賣小程序賺錢嗎百家號優(yōu)化
  • 做網(wǎng)站網(wǎng)頁排版錯誤怎么提升關(guān)鍵詞的質(zhì)量度
  • 做網(wǎng)站開發(fā)需要考什么證書seo深圳培訓(xùn)班
  • 智能小區(qū)物業(yè)管理系統(tǒng)網(wǎng)站推廣優(yōu)化
  • 奧門網(wǎng)站建設(shè)東莞seo技術(shù)
  • 給你一個網(wǎng)站你如何做優(yōu)化哪里可以引流到精準(zhǔn)客戶呢
  • 互聯(lián)網(wǎng)信息投訴平臺入口seo排名優(yōu)化哪家好
  • 濰坊網(wǎng)站建設(shè)工作室推廣平臺有哪些
  • 建網(wǎng)站帶app多少投資網(wǎng)絡(luò)推廣費(fèi)用高嗎
  • 淘寶網(wǎng)站建設(shè)教程視頻阿里云建站費(fèi)用
  • 哪個網(wǎng)站做批韓國護(hù)膚品批發(fā)qq刷贊網(wǎng)站推廣快速
  • 蘇州網(wǎng)站建設(shè)開發(fā)網(wǎng)絡(luò)推廣方法大全
  • 河北省人大建設(shè)研究會網(wǎng)站建一個網(wǎng)站需要多少錢?
  • 只做傳統(tǒng)嫁衣網(wǎng)站移投界seo
  • dw 如何做自適應(yīng)網(wǎng)站今天的新聞有哪些
  • 網(wǎng)站建設(shè)模板是什么意思網(wǎng)站構(gòu)建的基本流程