123456789101112131415161718192021222324252627282930313233343536373839 |
- // components/l-noticebar/index.js
- Component({
- attached () { this._init(); },
- pageLifetimes: { show () { this._init() } },
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- active: 0,
- time: 8000,
- },
- /**
- * 组件的方法列表
- */
- methods: {
- _init () {
- wx.lxd = wx.lxd || {}, wx.lxd.NoticeBar = e => {
- e.datalist = e.datalist.map((item, index) => {
- index == 0 ? item["active"] = true : item["active"] = false;
- return item;
- })
- this.setData({
- ...e
- })
- }
- },
- success (e) {
- let { datalist } = this.data, { index } = e.currentTarget.dataset;
- wx.navigateTo({
- url: datalist[index]["url"],
- })
- }
- }
- })
|