//好几个页面都有相同的逻辑,但是新建的publics.js,里面放入函数,不生效,请大神看看哪里出了问题。谢谢了。
<script>
import publics from './public'
export default {
components: {
publics,
},
data() {
return {
listAll:true,
}
},
created() {
this.initJson()
},
methods: {
//想把这个函数放入publics里,但是不生效,点击事件也不生效
initJson() {
console.log(this.listAll)
},
}
}
</script>
// 工具类函数存放
const publics = {
data() {
return {
}
},
created() {
},
methods: {
},
}
export default publics
使用
mixin