[更新]修改插件案例

This commit is contained in:
Anyon 2017-07-11 10:34:09 +08:00
parent dfd42dbeb3
commit 1803fdae47
2 changed files with 58 additions and 16 deletions

View File

@ -2,21 +2,20 @@
{block name="content"}
<div class="code">
<style>
.uploadbutton {
line-height: 50px;
display: inline-block;
position: absolute;
margin-left: 10px;
top: 20px;
}
</style>
<style>
.uploadbutton {
line-height: 50px;
display: inline-block;
position: absolute;
margin-left: 10px;
top: 20px;
}
</style>
<div class="code">
<blockquote class="site-text layui-elem-quote">
单图片上传
</blockquote>
<div style="position:relative">
<div class="uploadimage">
<input type="hidden" name="file_1"/>
@ -28,7 +27,6 @@
href="javascript:void(0)"
class="uploadbutton">上传图片</a>
</div>
<script>
require(['jquery'], function () {
$('[name="file_1"]').on('change', function () {
@ -37,7 +35,6 @@
});
});
</script>
<pre class="layui-code" lay-title="HTML代码">
<div style="position:relative">
@ -62,11 +59,56 @@ require(['jquery'], function () {
});
});
</pre>
</div>
<div class="code">
<blockquote class="site-text layui-elem-quote">
单文件上传
</blockquote>
<div style="position:relative">
<div class="input-group">
<input type="text" class="form-control" name="file_2" placeholder="请选择文件...">
<a class="input-group-addon"
data-file="one"
data-type="zip"
data-uptype="local"
data-field="file_2">
<i class="fa fa-file"></i>
</a>
</div>
</div>
<script>
require(['pcasunzips'], function () {
new PCAS('province', 'city', 'area', '广东省', '广州市', '海珠区');
require(['jquery'], function () {
$('[name="file_1"]').on('change', function () {
$(this).parent().css('backgroundImage', 'url(' + this.value + ')');
$(this).parent().attr('data-tips-image', this.value);
});
});
</script>
<pre class="layui-code" lay-title="HTML代码">
<div style="position:relative">
<div class="uploadimage">
<input type="hidden" name="file_1"/>
</div>
<a data-file="one"
data-field="file_1"
data-type="png,jpg"
data-uptype="local"
href="javascript:void(0)">上传图片</a>
</div>
</pre>
<pre class="layui-code" lay-title="javascript代码">
// 监听 input 的 onchange 事件
// 当有图片上传时,会触发 change 事件
require(['jquery'], function () {
$('[name="file_1"]').on('change', function () {
$(this).parent().css('backgroundImage', 'url(' + this.value + ')');
$(this).parent().attr('data-tips-image', this.value);
});
});
</pre>
</div>
<script>

View File

@ -11,7 +11,7 @@
// +----------------------------------------------------------------------
// | github开源项目https://github.com/zoujingli/Think.Admin
// +----------------------------------------------------------------------
return [];
/* 测试环境禁止操作路由绑定 */
think\Route::post([
// 禁止修改用户资料