my idea is that vue"s mixin can also be written as js custom module export, and then import comes in
is code reuse
but I changed mixn to js module, and there"s a big problem
vue.esm.js?efeb:1741 TypeError: Cannot read property "components" of undefined
at checkComponents (vue.esm.js?efeb:1330)
at mergeOptions (vue.esm.js?efeb:1451)
at mergeOptions (vue.esm.js?efeb:1467)
at Function.Vue.extend (vue.esm.js?efeb:4803)
at createComponent (vue.esm.js?efeb:4203)
at _createElement (vue.esm.js?efeb:4420)
at createElement (vue.esm.js?efeb:4357)
at vm._c (vue.esm.js?efeb:4489)
at Proxy.render (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-0ffbc2a2","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/news/detail/comment/Item.vue (app.js:7208), <anonymous>:144:13)
at VueComponent.Vue._render (vue.esm.js?efeb:4544)
procedure is whether the result returned by me using the js module method is displayed as a component or not v-if
//lib.js
let checkIsLogin= async function(){
const res = await api.auth.current({});
return res.isLoggedIn;
};
//componnts.vue
lib.checkIsLogin().then(function(res){
this.replying = res;
})
<child v-if="replying "></child>