QingWei-Li/vuep

Cannot find template element

nickofthyme opened this issue · 0 comments

Firstly, thanks for your effort on this, I love the idea of this component.

I found a problem with the way you pass the template prop to the vuep component referencing the string of code to render or the querySelection string to find the script tag of the code to render.

I keep getting an error that it can't be found because you are trying to querySelect the template element before it's even mounted. You need to change this to be done in mounted not created for vue to find that template element.

image

props: {
template: String,
options: {},
keepData: Boolean,
value: String
},

created () {
/* istanbul ignore next */
if (this.$isServer) return
let content = this.template
if (/^[\.#]/.test(this.template)) {
const html = document.querySelector(this.template)
if (!html) throw Error(`${this.template} is not found`)

Line 77 will never find the template on the dom