| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { getStatusBarHeight } from '../../stores/index'
- Component({
- externalClasses: ['custom-class'],
- properties: {
- // 返回的页数
- go: {
- type: Number,
- value: 1,
- },
- // 是否固定位置
- fixed: {
- type: Boolean,
- value: false,
- },
- dark: {
- type: Boolean,
- value: false,
- },
- },
- data: {
- styles: '',
- },
- methods: {
- // 关闭当前页面,返回上一页面或多级页面
- navigateBack() {
- wx.navigateBack({
- delta: this.data.go,
- });
- }
- },
- attached() {
- const styles: string[] = []
- if (this.data.fixed) {
- styles.push('position:fixed')
- styles.push('top:' + getStatusBarHeight() + 'px')
- }
- this.setData({
- styles: styles.join(';'),
- })
- }
- })
|