内容:

获取输入或其他操作使得值一直改变并在一段不改变的时间后执行下一步操作(输入搜索关键字并执行搜索)

https://vuejs.org/v2/guide/computed.html?spm=a2c7j.-zh-docs-components-recycle-list.0.0.9f1a3dcb7cO5F4#Watchers

var watchExampleVM = new Vue({
el: '#watch-example',
data: {
question: '',
answer: 'I cannot give you an answer until you ask a question!'
},
watch: {
// whenever question changes, this function will run
question: function (newQuestion, oldQuestion) {
this.answer = 'Waiting for you to stop typing...'
this.debouncedGetAnswer()
}
},
created: function () {
// _.debounce is a function provided by lodash to limit how
// often a particularly expensive operation can be run.
// In this case, we want to limit how often we access
// yesno.wtf/api, waiting until the user has completely
// finished typing before making the ajax request. To learn
// more about the _.debounce function (and its cousin
// _.throttle), visit: https://lodash.com/docs#debounce
this.debouncedGetAnswer = _.debounce(this.getAnswer, 500)
},
methods: {
getAnswer: function () {
if (this.question.indexOf('?') === -1) {
this.answer = 'Questions usually contain a question mark. ;-)'
return
}
this.answer = 'Thinking...'
var vm = this
axios.get('https://yesno.wtf/api')
.then(function (response) {
vm.answer = _.capitalize(response.data.answer)
})
.catch(function (error) {
vm.answer = 'Error! Could not reach the API. ' + error
})
}
}
})
</script>

js获取当前页面的地址(此处为完整路径)

this.$getConfig().bundleUrl

复杂表达式不应该出现在数据绑定中,可以通过定义计算computed属性来实现方便管理维护

<div id="example">
<p>Original message: "{{ message }}"</p>
<p>Computed reversed message: "{{ reversedMessage }}"</p>
</div>
var vm = new Vue({
el: '#example',
data: {
message: 'Hello'
},
computed: {
// a computed getter
reversedMessage: function () {
// `this` points to the vm instance
return this.message.split('').reverse().join('')
}
}
})

值绑定的操作只发生一次

通过使用 v-once 指令,你也能执行一次性地插值,当数据改变时,插值处的内容不会更新。但请留心这会影响到该节点上所有的数据绑定:

<span v-once>This will never change: {{ msg }}</span>

将输入控件的值通过v-model和属性值进行绑定

http://doc.vue-js.com/v2/guide/

<div id="app">
<p>{{ message }}</p>
<input v-model="message">
</div>

在莫个VUE文件中引用自定义控件的方法

import { WxcTabPage, WxcPanItem, Utils, BindEnv,WxcPopup } from 'weex-ui';
import ProblemsItem from "./problems-item";

通过比较可以容易发现前后写法之间的关系(没有设置component属性值)alt+点击可以进入查看莫个实现的写法

自定义控件增加一个事件(带上参数)

this.$emit('sendRequestForQuestion', this.problem);

设置属性时处理这个事件

<problems-item @sendRequestForQuestion = sendRequestForQuestion :problem=p />

上面同时设定了属性problem这个在空间中的属性定义为

export default {
components: { WxcPanItem },
props: {
problem: {
type: Object,
default: {}
},
},
data: () => ({ }),
methods: {
handleAskQuestion() {
// this.$notice.toast('handleAskQuestion:')
this.$emit('sendRequestForQuestion', this.problem);
}
}
}

data属性一定要写对位置,否者比如遇到BOOL类型的属性,可能出现页面不刷新或者只刷新第一次的问题

wxc-popup显示和点击空白会出现动画效果,点击上面的控件隐藏需要通过hide方法

popupBottomHide () {
this.$refs.popupContent.hide()
// this.$notice.toast('popupOverlayBottomClick:')
},

flex-grow元素占据父元素剩余空间的比例

list不存在自定义重用标识,每次都是重新移除/添加控件到Cell上面,而且不支持Group类型的list

http://dotwe.org/vue/035a0ee995d71c510161cba6e123d818

选项卡左右滑动切换类型页面

https://alibaba.github.io/weex-ui/#/cn/packages/wxc-tab-page/

左右上下弹出控件

https://alibaba.github.io/weex-ui/#/cn/packages/wxc-popup/

weex动画使用animation.transition函数

http://dotwe.org/vue/3e8660d7182f24901f122a0855c09370

https://www.jianshu.com/p/ab3e9f06f106

<script>
const animation = weex.requireModule('animation')
const modal = weex.requireModule('modal') export default {
data: function () {
return {
current_rotate: 0
}
},
mounted () {
let that = this
let el = this.$refs.test
setInterval(function () {
that.rotate(el)
}, 600)
},
methods: {
rotate (el) {
let self = this;
this.current_rotate+=360;
animation.transition(el, {
styles: {
color: '#FF0000',
transform: 'rotate(' + self.current_rotate + 'deg)',
transformOrigin: 'center center'
},
duration: 600, //ms
timingFunction: 'ease',
delay: 0 //ms
},function () { })
}
}
}
</script>

Weex开发中的应用小笔记的更多相关文章

  1. Android开发中实现桌面小部件

    详细信息请参考原文:Android开发中实现桌面小部件 在Android开发中,有时候我们的App设计的功能比较多的时候,需要根据需要更简洁的为用户提供清晰已用的某些功能的时候,用桌面小部件就是一个很 ...

  2. JAVA开发中遇到的小白点

    这里主要是自己个人开发中遇到的一些小问题,自己攒起来,来弥补自己薄弱的JAVA基础,大神不要见笑 1. DateFormat格式化的HH和hh区别: public static boolean com ...

  3. 在Android 开发中使用 SQLite 数据库笔记

    SQLite 介绍   SQLite 一个非常流行的嵌入式数据库,它支持 SQL 语言,并且只利用很少的内存就有很好的性能.此外它还是开源的,任何人都可以使用它.许多开源项目((Mozilla, PH ...

  4. RS开发中的一些小技巧[不定期更新]

    从9月份一直忙到了现在,项目整体的改版工作也完成了十有八九了,有些事情只有你自己真正的做了,你才能明白:哦,原来还可以这个样子,这样做真的好了很多呢,接下来我就分享一些最近遇到的RS开发的一些小技巧, ...

  5. APP落地页开发中的一些小经验~

    在开发日常落地页的时候,每当碰到一些很酷炫的宣传图用css实现很复杂且耗时的时候,一般采取切图然后将其放在页面中,在这个过程中发现<img/>标签中图片下方会有一行小空白,影响了与后一部分 ...

  6. Java开发中经典的小实例-(二分法)

    public int binarySearch(int[] data,int aim){//以int数组为例,aim为需要查找的数 int start = 0; int end = data.leng ...

  7. iOS开发中的零碎知识点笔记 韩俊强的博客

    每日更新关注:http://weibo.com/hanjunqiang  新浪微博 1.关联 objc_setAssociatedObject关联是指把两个对象相互关联起来,使得其中的一个对象作为另外 ...

  8. 日常开发中的shell小技巧

    工具推荐 命令行中很方便的代码统计工具---cloc 强大的分屏工具---tmux 最舒服的markdown书写工具---typora markdown图床推荐--七牛云 模拟生成熵(避免暴力手搓键盘 ...

  9. Android开发中遇到的小问题 一

    1)想要ListView活着Girdview左右留些空隙,但Scrollbar要在屏幕最右边 在xml中加入 android:paddingLeft="8dp" android:p ...

随机推荐

  1. 第八节,Opencv的基本使用------存取图像、视频功能、简单信息标注工具

    1.存取图像 import cv2 img=cv2.imread('test.jpg') cv2.imwrite('test1.jpg',img) 2.图像的仿射变换 图像的仿射变换涉及图像的形状位置 ...

  2. Docker入门-安装(一)

    Docker  在CentOS 7.0下安装Docker, CentOS 7.0默认使用的是firewall作为防火墙 查看防火墙状态 firewall-cmd --state 停止firewall ...

  3. 【原创】Linux基础之linux服务器服务器间拷贝文件

    linux服务器服务器间拷贝文件,有几种方式: 1 如果是定时任务,可以用rsync 2 如果是基于ssh登录,可以用scp,优点是可以实现远程到远程的拷贝,缺点是需要账号密码 upload: scp ...

  4. nohup + & 保证服务后台运行不中断

    nohup和&后台运行,进程查看及终止   1.nohup 用途:不挂断地运行命令. 语法:nohup Command [ Arg … ] [ & ] 无论是否将 nohup 命令的输 ...

  5. 27)django-form操作示例(动态Select数据,自定义字段验证,全局验证等)

    1)普通传递select数据 # -*- coding:utf-8 -*- __author__ = 'shisanjun' from django import forms from django. ...

  6. kali linux networking scanning Cookbok (第三章结尾笔记)

    1.Zombie Scanning with Nmap Zombie scans can also be performed with an option in Namp ,  we can find ...

  7. 快速部署docker

    前言:docker就不用说了,好东西啊.更好的利用服务器的资源,各个服务是相互隔离的,文件的存放更加规律,也好清理空间及数据备份 docker安装-----社区版ce(免费的,另一版本收钱的) 系统: ...

  8. 【Android】PreferenceActivity 详解

    PreferenceActivity是专业的设置界面,只要给它指定一个配置好的xml,它就能自动根据操作更改程序Preference的相应值. 首先要用一个xml文件来配置一个设置界面,也就是我们说的 ...

  9. vue 获取dom的css属性值

    <template> <div id="topInfo" ref="topInfo" style="width: 200px;hei ...

  10. c# 读取json文件信息

    两种方法: /// <summary> /// /// </summary> /// <returns></returns> private strin ...