123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- var Nova = getApp().Nova
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- options: null
- },
- /**
- * 组件的初始数据
- */
- data: {
- column: 'one', // 展示形式
- list: null
- },
- lifetimes: {
- attached: function () {
- let { options } = this.data
- let { data, style, column } = options
- console.log('课程组', options, data, style, column)
- this.setData({
- block: options,
- src: data.src,
- column,
- style
- })
- }
- },
- ready: function () {
- // 在组件布局完成后执行,确保options参数中有data信息
- this.loadData()
- },
- /**
- * 组件的方法列表
- */
- methods: {
- // 加载数据的重要方法
- loadData: async function () {
- await Nova.checkComponentsDataProperties(this)
- let list = await Nova.getBlockData(this.data.options.data)
- console.log('课程组', list)
- this.setData({
- list: list
- })
- },
- goNovaURL: function (ev) {
- console.log(ev)
- let { url, id } = ev.currentTarget.dataset
- if (id) {
- url = `/nova-lesson/pages/lesson-detail/lesson-detail?id=${id}`
- }
- console.log(url)
- Nova.goNovaURL(url)
- }
- }
- })
|