一直显示组件未注册,请大佬帮忙看看!
: Unknown custom element: <test_modal> - did you register the component correctly? For recursive components, make sure to provide the "name" option. 描述太简单 <template><div><a-button type="primary">确定</a-button></div>
</template>
<script>
import moment from 'moment'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'TestModal',
data() {
return {
headers: {},
//form: this.$form.createForm(this),
drawerWidth:700,
visible: false
}
},
created() {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
console.log("created")
},
methods: {
show:function() {
console.log("show");
this.visible=true;
}
}
}
</script>
<style scoped>
</style>
以上是我写的一个组件
在UserList.vue里调用
<test_modal ref="testModal"></test_modal>
import UserModal from './modules/UserModal'
components: {
SysUserAgentModal,
UserModal,
PasswordModal,
TestModal
},
都 有了
调用方法:
this.$refs.testModal.show();
但是显示那个错误。 admin_jh9 发表于 2019-7-22 11:40 static/image/common/back.gif
描述太简单
看看呢! 自己搞定了,原因是<test_modal ref="testModal"></test_modal>这句里的下划线错了,应该是中划线。
页:
[1]