收藏
回答

mobx-miniprogram miniprogram-computed 配合使用不了?

constcomputedBehavior = require('miniprogram-computed' )

计算不了import{ storeBindingsBehavior, createStoreBindings }from'mobx-miniprogram-bindings'

mobx 里面的值

就是 你们官方 出的这两个插件 怎么配合

使用


下面的identity 是mobx 的 可是在计算属性里面 找不到


import{ storeBindingsBehavior }from'mobx-miniprogram-bindings'

constcomputedBehavior = require('miniprogram-computed'

constapp = getApp()


Component({

behaviors: [storeBindingsBehavior, computedBehavior],

properties: {

current: {

type:String

value:'tabBarIndex'

},

},

storeBindings: {

store: app.store,

fields: {

identity:'identity'

},

},

computed: {

// showList: {

// require: ["$state", 'identity'],

// fn({ $state, identity }) {

// let arr = [

// ['bPostAdmin', 'tabBarTaskAdmin','tabBarMessage', 'tabBarMy'],

// ['tabBarIndex', 'tabBarDoTask', 'tabBarMessage', 'tabBarMy'],

// ][typeof identity !== 'undefined' ? identity - 1 : 1] || []


// return $state.tabBarList.filter(item => arr.includes(item.url))

// }

// },

showList (data) {

let{ $state, identity } = data

letarr = [

'bPostAdmin''tabBarTaskAdmin''tabBarMessage''tabBarMy'],

'tabBarIndex''tabBarDoTask''tabBarMessage''tabBarMy'],

][typeofidentity !=='undefined'? identity - : ] || []


return$state.tabBarList.filter(item => arr.includes(item.url))

},


},

data: {

},

methods: {

onChange(e) {

this.$_yp_goPage(e.detail)

},


})

回答关注问题邀请回答
收藏
登录 后发表内容
问题标签