This rules disallows using arrow functions to defined watcher.The reason is arrow functions bind the parent context, so this will not be the Vue instance as you expect.(see here for more details(opens new window))
@MeowBook nks-frontend % nodenv
nodenv 1.4.0+3.631d0b6
Usage: nodenv <command> [<args>]
Some useful nodenv commands are:
commands List all available nodenv commands
local Set or show the local application-specific Node version
global Set or show the global Node version
shell Set or show the shell-specific Node version
install Install a Node version using node-build
uninstall Uninstall a specific Node version
rehash Rehash nodenv shims (run this after installing executables)
version Show the current Node version and its origin
versions List installed Node versions
which Display the full path to an executable
whence List all Node versions that contain the given executable
See `nodenv help <command>' for information on a specific command.
For full documentation, see: <https://github.com/nodenv/nodenv#readme>
nodenv versions で既にインストール済みのバージョンを確認。
@MeowBook nks-frontend % nodenv versions
system
* 15.14.0 (set by /Users/xxx/Documents/xxx-frontend/.node-version)
16.0.0
16.2.0
<template>
<div>
<v-container>
<p>{{ longText }}</p>
</v-container>
<Footer />
</div>
</template>
<script>
export default {
data() {
return {
longText:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
}
},
}
</script>
<template>
<div>
<v-container>
<p>{{ longText | readMore(20, '...') }}</p> // フィルタを適用
</v-container>
<Footer />
</div>
</template>
<script>
export default {
filters: {
readMore: (text, length, suffix) => {
return text.substring(0, length) + suffix
},
}
data() {
return {
longText:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
}
},
}
</script>