初次使用vue的第三方组件vux总是报 _vm.$t is not a function的错误可是从来都没用过这个方法,为什么要定义呢?
<template>
<div>
<group>
<x-switch title="Basic Usage" v-model="show1"></x-switch>
</group>
<actionsheet v-model="show1" :menus="menus1" @on-click-menu="click"></actionsheet>
</div>
</template>
<script>
import {Actionsheet, Group, XSwitch} from 'vux'
export default {
components: {
Actionsheet,
Group,
XSwitch
},
data () {
return {
show1: false,
menus1: {
menu1: 'Share to friends',
menu2: 'Share to timeline'
}
}
},
methods: {
click (key) {
console.log(key)
},
}
}
</script>
<style>
</style>
你应该是用了配了i18n吧?用ToastPlugin等组件前先要use(i18n),像github的main.js那样
Vue.use(vuexI18n.plugin, store)
// plugins
import { DatetimePlugin, LocalePlugin, DevicePlugin, ToastPlugin, AlertPlugin, ConfirmPlugin, LoadingPlugin, WechatPlugin, AjaxPlugin, AppPlugin } from 'vux'
Vue.use(DevicePlugin)
Vue.use(ToastPlugin)
Vue.use(AlertPlugin)
Vue.use(ConfirmPlugin)
Vue.use(LoadingPlugin)
Vue.use(WechatPlugin)
Vue.use(AjaxPlugin)
Vue.use(LocalePlugin)
Vue.use(DatetimePlugin)