I'm using Svelte (v2.7) and Sapper (v0.12). According to the docs, this.refs should be available, but it's undefined for me, both in oncreate and custom methods.
My index.html looks like this:
<select id="wifi-ssid" ref="wifi-ssid">
...
<script>
export default {
oncreate() {
console.log('this.refs is undefined here', this.refs);
},
methods: {
getIsValid() {
console.log('this.refs is undefined here too', this.refs);
// ...
},
// ...
}
};
</script>
(Full code here).
I'm presuming this isn't a bug (otherwise everyone would have run into it?) and I've got something wrong as it's my first time using it.
This is deprecated, I believe the new syntax is <select bind:this={wifissid}>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With