This plugin lets you no logger write ref() and .value
npm i no-ref -D
yarn add no-ref -D
// vite.config.js
import { createNoRefVite } from "no-ref"
module.exports = {
plugins : [createNoRefVite()],
...
}
// vue.config.js
module.exports = {
chainWebpack(config) {
config.module
.rule('vue')
.use('no-ref')
.loader('no-ref')
.end()
}
}
// useRange.js
export function useRange(){
const start = ref(5)
const end =ref (15)
const width = ref(10)
return { start, end, width }
}
const { start/**use-ref*/, end, width } = useRange()
start.value++ // start.value = 6
(end).value++ // end.value = 16
console.log(width) // 10