-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(runtime-utils): support options api data, computed + methods (#963)
- Loading branch information
1 parent
cf1b48f
commit 9ec23da
Showing
5 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
<ul> | ||
<li data-testid="greetingInSetup"> | ||
{{ greetingInSetup }} | ||
</li> | ||
<li data-testid="greetingInData1"> | ||
{{ greetingInData1 }} | ||
</li> | ||
<li data-testid="greetingInData2"> | ||
{{ greetingInData2 }} | ||
</li> | ||
<li data-testid="greetingInComputed"> | ||
{{ greetingInComputed }} | ||
</li> | ||
<li data-testid="computedData1"> | ||
{{ computedData1 }} | ||
</li> | ||
<li data-testid="computedGreetingInMethods"> | ||
{{ computedGreetingInMethods }} | ||
</li> | ||
<li data-testid="greetingInMethods"> | ||
{{ greetingInMethods() }} | ||
</li> | ||
<li data-testid="returnData1"> | ||
{{ returnData1() }} | ||
</li> | ||
<li data-testid="returnComputedData1"> | ||
{{ returnComputedData1() }} | ||
</li> | ||
</ul> | ||
</template> | ||
|
||
<script lang="ts"> | ||
export default defineNuxtComponent({ | ||
name: 'OptionsApiPage', | ||
setup() { | ||
return { | ||
greetingInSetup: 'Hello, setup', | ||
} | ||
}, | ||
async asyncData() { | ||
return { | ||
greetingInData2: 'Hello, overwritten by asyncData', | ||
} | ||
}, | ||
data() { | ||
return { | ||
greetingInData1: 'Hello, data1', | ||
greetingInData2: 'Hello, data2', | ||
} | ||
}, | ||
computed: { | ||
greetingInComputed() { | ||
return 'Hello, computed property' | ||
}, | ||
computedData1() { | ||
return this.greetingInData1 | ||
}, | ||
computedGreetingInMethods() { | ||
return this.greetingInMethods() | ||
}, | ||
}, | ||
methods: { | ||
greetingInMethods() { | ||
return 'Hello, method' | ||
}, | ||
returnData1() { | ||
return this.greetingInData1 | ||
}, | ||
returnComputedData1() { | ||
return this.computedData1 | ||
}, | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters