1 | var mobileOtherInput= function(){ |
input type=date 不显示placeholder
1.在html中写 input type=area
2.在js中将type变成date
ps:1.手机端会显示键盘不会弹出日期选择框 所以js点击不能用focus方法
要用touchstart方法
并且this.focus() 要添加setTimeout
2.date 选中的字符串格式(“yyyy-mm-dd”)rails不能进行识别存成datetime类型
要将他变成“yyyy/mm/dd”格式之后存储 但是input type=date 不支持“yyyy/mm/dd”类型的显示
所以在显示之前还要变回 type="text"
eg:
1 | var mobileDatePicker = function(){ |
rails- redis
http://blog.csdn.net/pingpangbing0902/article/details/47104545
先运行redis-server /usr/local/etc/redis.conf
安装完之后新开一个窗口运行
bundle exec sidekiq
vue js - 封装component
1.slot 可以直接引用代码放进component中
有名字的要在父层代码中的标签上加上 slot =“”
没有名字的直接引了
2.要想从父层代码向component中传不改变的值,在component中声明一个props 然后在父层中绑定(:name=“”)就传进去了
3.如果要双向绑定的话,参考http://duxiao.sweetysoft.com/blog/posts/vuejs-v-model
如果是object的话一定要传value 接口中的值定义也要给一个”value”作为名称
4.在组件中要是想调用父层代码中方法的话
先定义@click=”onClickItem()”
然后 组件中的methods中加上
onClickItem () {
this.$emit(‘on-click-item’)
}
最后在父层需要调用方法的地方
@on_click_item=“xxx”
Xxx是在父层代码中定义的方法gg
error-There was a problem with the editor vi
1 | git config --global core.editor /usr/bin/vim |
解决js跨域问题
1.在代码端, 处理方式不变, 访问 /api + 原接口url:
this.$http.get(‘/api/interface/blogs/all’)…
2.在开发的时候, 继续保持vuejs 的代理存在. 配置代码如下:
proxyTable: {
‘/api’: {
target: ‘http://siwei.me',
changeOrigin: true,
pathRewrite: {
‘^/api’: ‘’
}
}
},
3.在nginx的配置文件中,加入代理:(详细说明见代码中的注释)
server {
listen 80;
server_name vue_demo.siwei.me;
client_max_body_size 500m;
charset utf-8;
root /opt/app/vue_demo;
# 第一步,把所有的 mysite.com/api/interface 转换成: mysite.com/interface
location /api {
rewrite ^(.*)\/api(.*)$ $1$2;
}
# 第二步, 把所有的 mysite.com/interface 的请求,转发到 siwei.me/interface
location /interface {
proxy_pass http://siwei.me;
}
}
就可以了.
也就是说, 上面的配置,把
http://vue_demo.siwei.me/api/interface/blogs/all
在服务器端做了个变换,相当于访问了:
http://siwei.me/interface/blogs/all
重启nginx , 就会发现生效了.
rails - 省市县三级联动数据脚本
1 | require 'httparty' |
将直辖市放到城市表中
1 | # -*- encoding : utf-8 -*- |
BOM图
ztreedemo
先将ztree的js文件和css文件放到项目中并引用 图片也加到assets/image中
1 | //= require jquery.ztree.all.min (放的哪个文件就引用哪个) |
controller
1 | def save_or_update |
view–html
1 | <div> |
view–js
1 | <script> |
注意:在这里没有用封装好的编辑方法 因为需要弹窗 否则可以直接用onRename方法
详情可见ztreeAPI文档
vue.js--表格搜索功能
1.添加一个component search/index.vue
1 | <template> |
2.在使用的页面上
1 | <div class="search"> |