Can Vue's computed
property be used with an external object?
Let's consider the following code example to illustrate the idea:
<!-- Vue file -->
<template>
<div>{{data.auth}}</div>
</template>
<script>
import {_data} form "./data"
export default {
computed: {
data() { return _data }
}
}
</script>
<!-- data.js file -->
let _auth = "123";
export let _data = {
auth: _auth
}
setTimeOut(() => _auth = "456", 2000)
Based on this code, one might expect the HTML document to switch from displaying "123" to "456" after 2000ms.
However, it seems that this functionality does not actually work as intended.