Commit 7051fa06 by 张立顺

去除组件 mixin方法

1 parent 60a22386
// components/Authorize/Authorize.js // components/Authorize/Authorize.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -39,7 +35,7 @@ Component({ ...@@ -39,7 +35,7 @@ Component({
} }
}, },
observers: { observers: {
'show': function (newVal) { show: function (newVal) {
this.setData({ this.setData({
openSet: newVal openSet: newVal
}) })
...@@ -48,9 +44,7 @@ Component({ ...@@ -48,9 +44,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
...@@ -60,13 +54,8 @@ Component({ ...@@ -60,13 +54,8 @@ Component({
*/ */
noScroll: wx.$util.noScroll(), noScroll: wx.$util.noScroll(),
cancel(e) { cancel(e) {
let { let { confirm } = e.currentTarget.dataset
confirm let { buttonType, title } = this.data
} = e.currentTarget.dataset
let {
buttonType,
title
} = this.data
let _this = this let _this = this
if (buttonType == 'getUserInfo' && confirm) { if (buttonType == 'getUserInfo' && confirm) {
wx.getUserProfile({ wx.getUserProfile({
...@@ -87,11 +76,7 @@ Component({ ...@@ -87,11 +76,7 @@ Component({
/**检验是否已授权位置 */ /**检验是否已授权位置 */
check() { check() {
const _this = this const _this = this
let { let { buttonType, scopeType, autoOpen } = this.properties
buttonType,
scopeType,
autoOpen
} = this.properties
if (buttonType != 'getPhoneNumber') { if (buttonType != 'getPhoneNumber') {
let type = `scope.${scopeType}` let type = `scope.${scopeType}`
buttonType = 'openSetting' buttonType = 'openSetting'
...@@ -128,12 +113,9 @@ Component({ ...@@ -128,12 +113,9 @@ Component({
} }
}) })
} }
}, },
/**授权手机号 */ /**授权手机号 */
getPhoneNumber({ getPhoneNumber({ detail }) {
detail
}) {
console.log(detail) console.log(detail)
this.triggerEvent('getphonenumber', detail) this.triggerEvent('getphonenumber', detail)
} }
...@@ -144,4 +126,4 @@ Component({ ...@@ -144,4 +126,4 @@ Component({
}, },
hide: function () {} hide: function () {}
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
import Calendar from './Calendar_Function' import Calendar from './Calendar_Function'
import _component_ from './Static_Properties' import _component_ from './Static_Properties'
const CalendarFunction = Symbol('CalendarFunction') const CalendarFunction = Symbol('CalendarFunction')
import {componentsMixin } from '../../mixins/index'
Component({ Component({
// behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -24,7 +22,7 @@ Component({ ...@@ -24,7 +22,7 @@ Component({
this[CalendarFunction].setCalenderBodyHeight() this[CalendarFunction].setCalenderBodyHeight()
}, },
showCalendar(e) { showCalendar(e) {
let type = e && e.currentTarget && e.currentTarget.dataset.type || '' let type = (e && e.currentTarget && e.currentTarget.dataset.type) || ''
let result = type === 'show' let result = type === 'show'
if (!result) { if (!result) {
this.setData({ this.setData({
...@@ -44,29 +42,19 @@ Component({ ...@@ -44,29 +42,19 @@ Component({
} }
}, },
dateChange(e) { dateChange(e) {
let { let { current } = e.detail
current
} = e.detail
this.setData({ this.setData({
current current
}) })
}, },
choose(e) { choose(e) {
let { let { dateType, minDate, maxDate } = this.data
dateType, let { data } = e.currentTarget.dataset
minDate,
maxDate
} = this.data
let {
data
} = e.currentTarget.dataset
if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return if ((minDate && Date.parse(minDate) > Date.parse(data)) || (maxDate && Date.parse(maxDate) < Date.parse(data))) return
this[CalendarFunction][dateType](e) this[CalendarFunction][dateType](e)
}, },
done() { done() {
let { let { dateType } = this.data
dateType
} = this.data
this[CalendarFunction].done(dateType) this[CalendarFunction].done(dateType)
}, },
changeDate(e) { changeDate(e) {
...@@ -87,4 +75,4 @@ Component({ ...@@ -87,4 +75,4 @@ Component({
attached() { attached() {
this[CalendarFunction] = new Calendar(this) this[CalendarFunction] = new Calendar(this)
} }
})
\ No newline at end of file \ No newline at end of file
})
// components/navigationBar/navigationBar.js // components/navigationBar/navigationBar.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
// behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -40,18 +36,9 @@ Component({ ...@@ -40,18 +36,9 @@ Component({
* 获取自定义导航栏信息 * 获取自定义导航栏信息
*/ */
wx.getSystemInfo().then(res => { wx.getSystemInfo().then(res => {
let { let { fontSizeSetting, statusBarHeight, screenWidth } = res
fontSizeSetting, const { height, right, width, top } = wx.getMenuButtonBoundingClientRect()
statusBarHeight, let navigationBarHeight = height + (top - statusBarHeight) * 2 + 4 // 4
screenWidth
} = res
const {
height,
right,
width,
top
} = wx.getMenuButtonBoundingClientRect()
let navigationBarHeight = height + ((top - statusBarHeight) * 2) + 4 // 4
let navigationBarPadding = screenWidth - right let navigationBarPadding = screenWidth - right
let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width let navigationBarWidth = screenWidth - (navigationBarPadding * 2 + width) - width
this.setData({ this.setData({
...@@ -66,10 +53,7 @@ Component({ ...@@ -66,10 +53,7 @@ Component({
}) })
}) })
}, },
emit({ emit({ navigationBarHeight, statusBarHeight }) {
navigationBarHeight,
statusBarHeight
}) {
let navHeight = navigationBarHeight + statusBarHeight let navHeight = navigationBarHeight + statusBarHeight
const thisPage = wx.$router.getPageInstance() const thisPage = wx.$router.getPageInstance()
const currentPages = getCurrentPages() const currentPages = getCurrentPages()
...@@ -84,9 +68,10 @@ Component({ ...@@ -84,9 +68,10 @@ Component({
navHeight, navHeight,
statusBarHeight statusBarHeight
}) })
if (currentPages.length == 1 && !thisPage.rootName) thisPage.setData({ if (currentPages.length == 1 && !thisPage.rootName)
showHomeBtn: true thisPage.setData({
}) showHomeBtn: true
})
} }
}, },
lifetimes: { lifetimes: {
...@@ -95,4 +80,4 @@ Component({ ...@@ -95,4 +80,4 @@ Component({
this.setPageTitle() this.setPageTitle()
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
// tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js // tabWorkOrder/pages/createOrder/createOrderComponents/Popup/Popup.js
import {
componentsMixin
} from '../../mixins/index'
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -30,7 +26,6 @@ Component({ ...@@ -30,7 +26,6 @@ Component({
hideTab hideTab
}) })
} }
} }
}, },
title: String, title: String,
...@@ -47,9 +42,7 @@ Component({ ...@@ -47,9 +42,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -66,11 +59,9 @@ Component({ ...@@ -66,11 +59,9 @@ Component({
} }
}, },
attached() { attached() {
const { const { isTab } = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
isTab
} = wx.$router.getRouterList().find(item => item.url === `/${wx.$router.getPageInstance().route}`)
this.setData({ this.setData({
isTab isTab
}) })
},
})
\ No newline at end of file \ No newline at end of file
}
})
// components/SearchBox/SearchBox.js // components/SearchBox/SearchBox.js
import {componentsMixin } from '../../mixins/index';
Component({ Component({
behaviors: [componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
placeholder: { placeholder: {
type: String, type: String,
value: "请输入搜索内容", value: '请输入搜索内容'
}, },
value: { value: {
type: String, type: String,
value: "", value: '',
observer(n) { observer(n) {
this.setData({ this.setData({
inputValue: n, inputValue: n
}); })
}, }
}, },
searchType: { searchType: {
type: Number, type: Number,
value: 1, value: 1
}, },
couponDetails: Boolean, couponDetails: Boolean
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
inputValue: "", inputValue: ''
}, },
/** /**
...@@ -38,29 +36,29 @@ Component({ ...@@ -38,29 +36,29 @@ Component({
*/ */
methods: { methods: {
input(e) { input(e) {
let { value } = e.detail; let { value } = e.detail
this.setData({ this.setData({
inputValue: value, inputValue: value
}); })
}, },
blur(e) { blur(e) {
let { inputValue } = this.data; let { inputValue } = this.data
this.setData({ this.setData({
inputValue, inputValue
}); })
}, },
clear() { clear() {
this.setData({ this.setData({
inputValue: "", inputValue: ''
}); })
}, },
confirm(e) { confirm(e) {
let { value } = e.detail; let { value } = e.detail
this.triggerEvent("search", value); this.triggerEvent('search', value)
}, },
search(e) { search(e) {
let { value } = e.currentTarget.dataset; let { value } = e.currentTarget.dataset
this.triggerEvent("search", value); this.triggerEvent('search', value)
}, }
}, }
}); })
// components/SearchInput/SearchInput.js // components/SearchInput/SearchInput.js
import {componentsMixin } from '../../mixins/index'
Component({ Component({
behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -22,9 +20,7 @@ Component({ ...@@ -22,9 +20,7 @@ Component({
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {},
},
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -39,9 +35,7 @@ Component({ ...@@ -39,9 +35,7 @@ Component({
}) })
}, },
input(e) { input(e) {
let { let { value } = e.detail
value
} = e.detail
this.setValue(value) this.setValue(value)
this.triggerEvent('input', { this.triggerEvent('input', {
value value
...@@ -55,9 +49,7 @@ Component({ ...@@ -55,9 +49,7 @@ Component({
}, },
emit(e) { emit(e) {
let { let {
detail:{ detail: { value },
value
},
type type
} = e } = e
this.setData({ this.setData({
...@@ -69,4 +61,4 @@ Component({ ...@@ -69,4 +61,4 @@ Component({
}) })
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
// components/Tab/Tab.js // components/Tab/Tab.js
import {componentsMixin } from '../../mixins/index'
Component({ Component({
behaviors:[componentsMixin],
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
...@@ -36,9 +34,7 @@ Component({ ...@@ -36,9 +34,7 @@ Component({
*/ */
methods: { methods: {
click(e) { click(e) {
let { let { count } = e.currentTarget.dataset
count
} = e.currentTarget.dataset
this.setData({ this.setData({
count, count,
to: `to-${count}` to: `to-${count}`
...@@ -46,4 +42,4 @@ Component({ ...@@ -46,4 +42,4 @@ Component({
this.triggerEvent('click', count) this.triggerEvent('click', count)
} }
} }
})
\ No newline at end of file \ No newline at end of file
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!