init
This commit is contained in:
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.js
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";const e=require("../../../../common/vendor.js"),t=require("../_constants/event.js"),o=require("../_constants/prefix.js"),i=require("../_hooks/useSelectorQuery.js"),s=require("../_utils/is.js");require("../_utils/env.js");const n=require("../_utils/pxCheck.js"),r=require("../_utils/style.js"),a=require("../_utils/props.js"),l={...a.commonProps,direction:a.makeStringProp("across"),list:a.makeArrayProp([]),standTime:a.makeNumberProp(1e3),complexAm:Boolean,height:a.makeNumberProp(40),text:a.makeStringProp(""),closeMode:Boolean,leftIcon:a.truthProp,customColor:a.makeStringProp(""),background:a.makeStringProp(""),delay:a.makeNumericProp(1),scrollable:a.truthProp,speed:a.makeNumberProp(50),wrapable:Boolean,fieldName:String},c={[t.CLICK_EVENT]:e=>e instanceof Object||s.isString(e),[t.CLOSE_EVENT]:e=>e instanceof Object||s.isString(e),acrossEnd:e=>e instanceof Object};Math||u();const u=()=>"../icon/icon.js",d=`${o.PREFIX}-noticebar`,m=e.defineComponent({name:d,options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"}}),p=e.defineComponent({...m,props:l,emits:c,setup(o,{emit:a}){const l=o,c=a,u=e.getCurrentInstance(),{getSelectorNodeInfo:m}=i.useSelectorQuery(u);e.ref(null),e.ref(null);const p=e.reactive({wrapWidth:0,firstRound:!0,duration:0,offsetWidth:0,showNoticebar:!0,animationClass:"",animate:!1,scrollList:[],distance:0,timer:null,keepAlive:!1,isCanScroll:null,showNotica:!0,id:Math.round(1e5*Math.random())}),h=e.computed((()=>r.getMainClass(l,d))),f=e.computed((()=>null!=p.isCanScroll&&(!p.isCanScroll&&!l.wrapable))),g=e.computed((()=>({"nut-noticebar__page-wrap-content":!0,"nut-ellipsis":f.value,[`content${p.id}`]:!0,[p.animationClass]:!0}))),b=e.computed((()=>{const e={};return l.customColor&&(e.color=l.customColor),l.background&&(e.background=l.background),"vertical"===l.direction&&(e.height=`${l.height}px`),e})),C=e.computed((()=>({animationDelay:`${p.firstRound?l.delay:0}s`,animationDuration:`${p.duration}s`,transform:`translateX(${p.firstRound?0:`${p.wrapWidth}px`})`}))),v=e.computed((()=>{let e={};return l.complexAm?e={transform:`translateY(${p.distance}px)`}:p.animate&&(e={transition:`all ${~~(l.height/l.speed/4)}s`,"margin-top":`-${l.height}px`}),e}));function w(){!1!==p.showNoticebar&&setTimeout((()=>{if(!1===p.showNoticebar)return;let e=0,t=0;m(`.wrap${p.id}`).then((o=>{o.width>0&&(e=o.width),m(`.content${p.id}`).then((o=>{o.width>0&&(t=o.width),p.isCanScroll=null==l.scrollable?t>e:l.scrollable,p.isCanScroll?(p.wrapWidth=e,p.offsetWidth=t,p.duration=t/l.speed,p.animationClass="play"):p.animationClass=""}))}))}),100)}function k(e){c("click",e)}function N(e){l.closeMode&&(p.showNoticebar=!l.closeMode),c("close",e)}function x(e){p.firstRound=!1,c("acrossEnd",e),setTimeout((()=>{p.duration=(p.offsetWidth+p.wrapWidth)/l.speed,p.animationClass="play-infinite"}),0)}function S(){p.animate=!0,setTimeout((()=>{p.scrollList.push(p.scrollList[0]),p.scrollList.shift(),p.animate=!1}),1e3*~~(l.height/l.speed/4))}function L(e,t){setTimeout((()=>{p.distance-=l.height/100,t&&(p.scrollList.push(p.scrollList[0]),p.scrollList.shift(),p.distance=0)}),e*l.speed)}return e.watch((()=>l.text),(()=>{w()})),e.watch((()=>l.list),(e=>{p.scrollList=[].concat(e)})),e.onMounted((()=>{"vertical"===l.direction?(p.scrollList=[].concat(l.list),setTimeout((()=>{l.complexAm?p.timer=setInterval((()=>{for(let e=0;e<100;e++)L(e,!(e<99))}),l.standTime+100*l.speed):(S(),p.timer=setInterval(S,1e3*~~(l.height/l.speed/4)+l.standTime))}),l.standTime)):w()})),e.onActivated((()=>{p.keepAlive&&(p.keepAlive=!1)})),e.onDeactivated((()=>{p.keepAlive=!0,clearInterval(p.timer)})),e.onUnmounted((()=>{clearInterval(p.timer)})),(o,i)=>e.e({a:"across"===o.direction},"across"===o.direction?e.e({b:o.leftIcon},o.leftIcon?{c:e.p({name:"notice",size:"16px"})}:{},{d:e.t(o.text),e:e.n(g.value),f:e.s(C.value),g:e.o(((...e)=>x&&x(...e))),h:e.o(((...e)=>x&&x(...e))),i:e.n(`nut-noticebar__page-wrap wrap${p.id}`),j:o.closeMode||o.$slots.rightIcon},o.closeMode||o.$slots.rightIcon?{k:e.p({name:"circle-close"}),l:e.o(((...e)=>N&&N(...e)))}:{},{m:o.closeMode?1:"",n:o.closeMode?1:"",o:o.wrapable?1:"",p:p.showNoticebar?"":1,q:e.s(b.value),r:e.o(((...e)=>k&&k(...e)))}):{},{s:p.scrollList.length>0&&"vertical"===o.direction&&p.showNoticebar},p.scrollList.length>0&&"vertical"===o.direction&&p.showNoticebar?e.e({t:e.f(p.scrollList,((o,i,n)=>({a:e.t(l.fieldName&&e.unref(s.isObject)(o)?o[l.fieldName]:o),b:i,c:e.o((e=>function(e){c(t.CLICK_EVENT,e)}(o)),i)}))),v:e.unref(n.pxCheck)(o.height),w:e.unref(n.pxCheck)(o.height),x:e.s(v.value),y:o.closeMode},o.closeMode?{z:e.p({name:"circle-close","custom-color":o.customColor,size:"11px"})}:{},{A:e.o((e=>(l.closeMode&&(p.showNoticebar=!l.closeMode),void c(t.CLOSE_EVENT,p.scrollList[0])))),B:e.s(b.value)}):{},{C:e.n(h.value),D:e.s(o.customStyle)})}});wx.createComponent(p);
|
||||
6
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.json
vendored
Normal file
6
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"nut-icon": "../icon/icon"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.wxml
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{C}}" style="{{D}}"><view wx:if="{{a}}" class="{{['nut-noticebar__page', m && 'nut-noticebar__page--withicon', n && 'nut-noticebar__page--close', o && 'nut-noticebar__page--wrapable', p && 'nut-hidden']}}" style="{{q}}" bindtap="{{r}}"><view wx:if="{{b}}" class="nut-noticebar__page-lefticon"><block wx:if="{{$slots.leftIcon}}"><slot name="leftIcon"></slot></block><block wx:else><nut-icon wx:if="{{c}}" u-i="762e8852-0" bind:__l="__l" u-p="{{c}}"/></block></view><view ref="wrap" class="{{i}}"><view ref="content" class="{{e}}" style="{{f}}" bindanimationend="{{g}}" bind:webkit-animation-end="{{h}}"><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{d}}</block></view></view><view wx:if="{{j}}" class="nut-noticebar__page-righticon" catchtap="{{l}}"><block wx:if="{{$slots.rightIcon}}"><slot name="rightIcon"></slot></block><block wx:else><nut-icon wx:if="{{k}}" u-i="762e8852-1" bind:__l="__l" u-p="{{k}}"/></block></view></view><view wx:if="{{s}}" class="nut-noticebar__vertical" style="{{B}}"><view class="nut-noticebar__vertical-list" style="{{x}}"><view wx:for="{{t}}" wx:for-item="item" wx:key="b" class="nut-noticebar__vertical-item" style="{{'height:' + v + ';' + ('line-height:' + w)}}" bindtap="{{item.c}}">{{item.a}}</view></view><view class="go" bindtap="{{A}}"><block wx:if="{{$slots.rightIcon}}"><slot name="rightIcon"></slot></block><block wx:else><nut-icon wx:if="{{y}}" u-i="762e8852-2" bind:__l="__l" u-p="{{z}}"/></block></view></view></view>
|
||||
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.wxss
vendored
Normal file
1
unpackage/dist/build/mp-weixin/uni_modules/nutui-uni/components/noticebar/noticebar.wxss
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.nut-theme-dark .nut-noticebar__page{color:var(--nut-dark-color, var(--nut-white, #fff));background:var(--nut-dark-background2, #1b1b1b)}.nut-theme-dark .nut-noticebar__vertical{color:var(--nut-dark-color, var(--nut-white, #fff))}.nut-noticebar__page{position:relative;display:flex;align-items:center;height:var(--nut-noticebar-across-height, 40px);padding:var(--nut-noticebar-box-padding, 0 16px);font-size:var(--nut-noticebar-font-size, 14px);color:var(--nut-noticebar-color, #d9500b);background:var(--nut-noticebar-background, #fbf8dc)}.nut-noticebar__page--wrapable{height:auto;padding:var(--nut-noticebar-wrapable-padding, 16px)}.nut-noticebar__page--wrapable .nut-noticebar__page-wrap{height:auto!important}.nut-noticebar__page--wrapable .nut-noticebar__page-wrap .nut-noticebar__page-wrap-content{position:relative;word-wrap:break-word;white-space:normal}.nut-noticebar__page .nut-noticebar__page--withicon{position:relative;padding-right:40px}.nut-noticebar__page .nut-noticebar__page-lefticon{display:flex;align-items:center;margin:var(--nut-noticebar-lefticon-margin, 0 10px);background-size:100% 100%}.nut-noticebar__page .nut-noticebar__page-righticon{display:flex;align-items:center;justify-content:center;margin:var(--nut-noticebar-righticon-margin, 0 10px)}.nut-noticebar__page .nut-noticebar__page-wrap{position:relative;display:flex;flex:1;height:var(--nut-noticebar-across-line-height, 24px);overflow:hidden;line-height:var(--nut-noticebar-across-line-height, 24px)}.nut-noticebar__page .nut-noticebar__page-wrap-content{position:absolute;white-space:nowrap}.nut-noticebar__page .nut-noticebar__page-wrap-content.nut-ellipsis{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nut-noticebar__page .play{animation:nut-notice-bar-play linear both running}.nut-noticebar__page .play-infinite{animation:nut-notice-bar-play-infinite linear infinite both running}.nut-noticebar__page .play-vertical{animation:nut-notice-bar-play-vertical linear infinite both running}@keyframes nut-notice-bar-play{to{transform:translate3d(-100%,0,0)}}@keyframes nut-notice-bar-play-infinite{to{transform:translate(-100%)}}@keyframes nut-notice-bar-play-vertical{to{transform:translateY(var(--nut-noticebar-across-height, 40px))}}.nut-noticebar__vertical{position:relative;display:flex;justify-content:space-between;height:var(--nut-noticebar-across-height, 40px);padding:var(--nut-noticebar-box-padding, 0 16px);overflow:hidden;font-size:var(--nut-noticebar-font-size, 14px);color:var(--nut-noticebar-color, #d9500b);background:var(--nut-noticebar-background, #fbf8dc)}.nut-noticebar__vertical .nut-noticebar__vertical-list{display:block;flex:1;width:100%;padding:0;margin:0;overflow:hidden}.nut-noticebar__vertical .nut-noticebar__vertical-list .nut-noticebar__vertical-item{width:100%;height:var(--nut-noticebar-across-height, 40px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nut-noticebar__vertical .nut-noticebar-custom-item{position:absolute;top:999999px}.nut-noticebar__vertical .go{display:flex;align-self:center;margin:var(--nut-noticebar-righticon-margin, 0 10px)}
|
||||
Reference in New Issue
Block a user