Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
紫潇清竹
weui-wxss
提交
35f73e76
W
weui-wxss
项目概览
紫潇清竹
/
weui-wxss
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
weui-wxss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
35f73e76
编写于
11月 10, 2016
作者:
B
bearyan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v0.1.1
[修复] navbar的样式按小程序的规范来重新编写
上级
99fb0f91
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
136 addition
and
46 deletion
+136
-46
CHANGELOG.md
CHANGELOG.md
+4
-0
dist/example/navbar/navbar.js
dist/example/navbar/navbar.js
+16
-1
dist/example/navbar/navbar.wxml
dist/example/navbar/navbar.wxml
+4
-1
dist/style/weui.wxss
dist/style/weui.wxss
+24
-9
dist/style/widget/weui-tab/weui-navbar.wxss
dist/style/widget/weui-tab/weui-navbar.wxss
+24
-9
dist/style/widget/weui-tab/weui-tab.wxss
dist/style/widget/weui-tab/weui-tab.wxss
+24
-9
package.json
package.json
+1
-1
src/example/navbar/navbar.js
src/example/navbar/navbar.js
+16
-1
src/example/navbar/navbar.wxml
src/example/navbar/navbar.wxml
+4
-1
src/style/widget/weui-tab/weui-navbar.wxss
src/style/widget/weui-tab/weui-navbar.wxss
+19
-14
未找到文件。
CHANGELOG.md
浏览文件 @
35f73e76
#### v0.1.1 (2016-11-10)
-
[修复] navbar的样式按小程序的规范来重新编写
#### v0.1.0 (2016-11-10)
初始发布
...
...
dist/example/navbar/navbar.js
浏览文件 @
35f73e76
var
sliderWidth
=
96
;
// 需要设置slider的宽度,用于计算中间位置
Page
({
data
:
{
tabs
:
[
"
选项一
"
,
"
选项二
"
,
"
选项三
"
],
activeIndex
:
"
0
"
activeIndex
:
"
0
"
,
sliderOffset
:
0
,
sliderLeft
:
0
},
onLoad
:
function
()
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
sliderLeft
:
(
res
.
windowWidth
/
that
.
data
.
tabs
.
length
-
sliderWidth
)
/
2
});
}
});
},
tabClick
:
function
(
e
)
{
this
.
setData
({
sliderOffset
:
e
.
currentTarget
.
offsetLeft
,
activeIndex
:
e
.
currentTarget
.
id
});
}
...
...
dist/example/navbar/navbar.wxml
浏览文件 @
35f73e76
...
...
@@ -3,8 +3,11 @@
<view class="weui-tab">
<view class="weui-navbar">
<block wx:for-items="{{tabs}}" wx:key="{{index}}">
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">{{item}}</view>
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
<view class="weui-navbar__title">{{item}}</view>
</view>
</block>
<view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
</view>
<view class="weui-tab__panel">
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">选项一的内容</view>
...
...
dist/style/weui.wxss
浏览文件 @
35f73e76
...
...
@@ -896,7 +896,6 @@ icon {
z-index: 500;
top: 0;
width: 100%;
background-color: #fafafa;
border-bottom: 1rpx solid #CCCCCC;
}
.weui-navbar__item {
...
...
@@ -907,17 +906,33 @@ icon {
flex: 1;
padding: 13px 0;
text-align: center;
font-size: 15px;
border-right: 1rpx solid #CCCCCC;
}
.weui-navbar__item:active {
background-color: #ededed;
font-size: 0;
}
.weui-navbar__item.weui-bar__item_on {
background-color: #eaeaea
;
color: #1AAD19
;
}
.weui-navbar__item:last-child:after {
display: none;
.weui-navbar__slider {
position: absolute;
content: " ";
left: 0;
bottom: 0;
width: 6em;
height: 3px;
background-color: #1AAD19;
-webkit-transition: -webkit-transform .3s;
transition: -webkit-transform .3s;
transition: transform .3s;
transition: transform .3s, -webkit-transform .3s;
}
.weui-navbar__title {
display: inline-block;
font-size: 15px;
max-width: 8em;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
}
.weui-tab {
position: relative;
...
...
dist/style/widget/weui-tab/weui-navbar.wxss
浏览文件 @
35f73e76
...
...
@@ -6,7 +6,6 @@
z-index: 500;
top: 0;
width: 100%;
background-color: #fafafa;
border-bottom: 1rpx solid #CCCCCC;
}
.weui-navbar__item {
...
...
@@ -17,15 +16,31 @@
flex: 1;
padding: 13px 0;
text-align: center;
font-size: 15px;
border-right: 1rpx solid #CCCCCC;
}
.weui-navbar__item:active {
background-color: #ededed;
font-size: 0;
}
.weui-navbar__item.weui-bar__item_on {
background-color: #eaeaea
;
color: #1AAD19
;
}
.weui-navbar__item:last-child:after {
display: none;
.weui-navbar__slider {
position: absolute;
content: " ";
left: 0;
bottom: 0;
width: 6em;
height: 3px;
background-color: #1AAD19;
-webkit-transition: -webkit-transform .3s;
transition: -webkit-transform .3s;
transition: transform .3s;
transition: transform .3s, -webkit-transform .3s;
}
.weui-navbar__title {
display: inline-block;
font-size: 15px;
max-width: 8em;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
}
dist/style/widget/weui-tab/weui-tab.wxss
浏览文件 @
35f73e76
...
...
@@ -6,7 +6,6 @@
z-index: 500;
top: 0;
width: 100%;
background-color: #fafafa;
border-bottom: 1rpx solid #CCCCCC;
}
.weui-navbar__item {
...
...
@@ -17,17 +16,33 @@
flex: 1;
padding: 13px 0;
text-align: center;
font-size: 15px;
border-right: 1rpx solid #CCCCCC;
}
.weui-navbar__item:active {
background-color: #ededed;
font-size: 0;
}
.weui-navbar__item.weui-bar__item_on {
background-color: #eaeaea
;
color: #1AAD19
;
}
.weui-navbar__item:last-child:after {
display: none;
.weui-navbar__slider {
position: absolute;
content: " ";
left: 0;
bottom: 0;
width: 6em;
height: 3px;
background-color: #1AAD19;
-webkit-transition: -webkit-transform .3s;
transition: -webkit-transform .3s;
transition: transform .3s;
transition: transform .3s, -webkit-transform .3s;
}
.weui-navbar__title {
display: inline-block;
font-size: 15px;
max-width: 8em;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
}
.weui-tab {
position: relative;
...
...
package.json
浏览文件 @
35f73e76
{
"name"
:
"weui-wxss"
,
"version"
:
"0.1.
0
"
,
"version"
:
"0.1.
1
"
,
"description"
:
"weui-wxss"
,
"main"
:
"dist/app.wxss"
,
"directories"
:
{
...
...
src/example/navbar/navbar.js
浏览文件 @
35f73e76
var
sliderWidth
=
96
;
// 需要设置slider的宽度,用于计算中间位置
Page
({
data
:
{
tabs
:
[
"
选项一
"
,
"
选项二
"
,
"
选项三
"
],
activeIndex
:
"
0
"
activeIndex
:
"
0
"
,
sliderOffset
:
0
,
sliderLeft
:
0
},
onLoad
:
function
()
{
var
that
=
this
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
that
.
setData
({
sliderLeft
:
(
res
.
windowWidth
/
that
.
data
.
tabs
.
length
-
sliderWidth
)
/
2
});
}
});
},
tabClick
:
function
(
e
)
{
this
.
setData
({
sliderOffset
:
e
.
currentTarget
.
offsetLeft
,
activeIndex
:
e
.
currentTarget
.
id
});
}
...
...
src/example/navbar/navbar.wxml
浏览文件 @
35f73e76
...
...
@@ -3,8 +3,11 @@
<view class="weui-tab">
<view class="weui-navbar">
<block wx:for-items="{{tabs}}" wx:key="{{index}}">
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">{{item}}</view>
<view id="{{index}}" class="weui-navbar__item {{activeIndex == index ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
<view class="weui-navbar__title">{{item}}</view>
</view>
</block>
<view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
</view>
<view class="weui-tab__panel">
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">选项一的内容</view>
...
...
src/style/widget/weui-tab/weui-navbar.wxss
浏览文件 @
35f73e76
@import "../../base/fn.wxss";
@weuiNavBarColor: #1AAD19;
.weui-navbar {
display: flex;
position: absolute;
z-index: 500;
top: 0;
width: 100%;
background-color: #fafafa;
border-bottom: 1rpx solid #CCCCCC;
}
...
...
@@ -16,20 +16,25 @@
flex: 1;
padding: 13px 0;
text-align: center;
font-size: 15px;
border-right: 1rpx solid #CCCCCC;
&:active {
background-color: #ededed;
}
font-size: 0;
&.weui-bar__item_on {
background-color: #eaeaea;
}
&:last-child {
&:after {
display: none;
}
color: @weuiNavBarColor;
}
}
.weui-navbar__slider {
position: absolute;
content: " ";
left: 0;
bottom: 0;
width: 6em;
height: 3px;
background-color: @weuiNavBarColor;
transition: transform .3s;
}
.weui-navbar__title{
display: inline-block;
font-size: 15px;
max-width: 8em;
.ellipsis();
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录