123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- const Parse = getApp().Parse;
- const company = getApp().globalData.company
- Component({
- behaviors: [],
- // 属性定义(详情参见下文)
- properties: {
- options: null,
- },
- data: {
- value: '',
- }, // 私有数据,可用于模板渲染
- lifetimes: {
- // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
- attached: function () {
- let {
- options
- } = this.data
- console.log('搜索栏', options);
- let {
- data,
- src,
- style,
- } = options
- let {
- className,
- equalTo
- } = data[0]
- console.log(className, equalTo);
- let {
- backgroundColor,
- borderRadius,
- btnBgColor,
- btnBorderRadius,
- btnColor,
- btnFontSize,
- btnHeight,
- btnMargin,
- btnWidth,
- height,
- iconColor,
- iconMargin,
- iconSize,
- inputBgColor,
- inputBorderRadius,
- inputColor,
- inputFontSize,
- inputHeight,
- inputMargin,
- inputPadding,
- inputWidth,
- margin,
- opacity,
- padding,
- placeholder,
- placeholderColor,
- width,
- } = style
- this.setData({
- src,
- backgroundColor,
- borderRadius,
- btnBgColor,
- btnBorderRadius,
- btnColor,
- btnFontSize,
- btnHeight,
- btnMargin,
- btnWidth,
- height,
- iconColor,
- iconMargin,
- iconSize,
- inputBgColor,
- inputBorderRadius,
- inputColor,
- inputFontSize,
- inputHeight,
- inputMargin,
- inputPadding,
- inputWidth,
- margin,
- opacity,
- padding,
- placeholder,
- placeholderColor,
- width,
- className,
- equalTo
- })
- },
- moved: function () {},
- detached: function () {},
- },
- ready: function () {},
- pageLifetimes: {
- // 组件所在页面的生命周期函数
- show: function () {},
- hide: function () {},
- resize: function () {},
- },
- methods: {
- goGoodsLitst() {
- let {
- value,
- className,
- equalTo
- } = this.data
- if(!value) {
- wx.showToast({
- title: '请输入需要搜索的内容',
- icon: 'none'
- })
- return
- }
- wx.navigateTo({
- url: '/nova-shop/pages/search-list/index?value=' + value,
- success: (res) => {
- res.eventChannel.emit('acceptDataFromOpenerPage', {
- value,
- className,
- equalTo,
- })
- },
- fail: () => {},
- complete: () => {}
- });
- },
- onMyButtonTap: function () {
- this.setData({
- // 更新属性和数据的方法与更新页面数据的方法类似
- })
- },
- // 内部方法建议以下划线开头
- _myPrivateMethod: function () {
- // 这里将 data.A[0].B 设为 'myPrivateData'
- this.setData({
- 'A[0].B': 'myPrivateData'
- })
- },
- _propertyChange: function (newVal, oldVal) {
- }
- }
- })
|