Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script setup:マークダウン系のコンポーネントを移行 #1093

Merged
merged 8 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
717 changes: 169 additions & 548 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
"markdown-it": "12.0.4",
"move-file": "3.0.0",
"multistream": "4.1.0",
"quasar": "2.4.13",
"quasar": "2.11.3",
"semver": "7.3.5",
"shlex": "2.1.2",
"source-map-support": "0.5.19",
"systeminformation": "5.8.0",
"tree-kill": "1.2.2",
"unzipper": "0.10.11",
"uuid": "9.0.0",
"vue": "3.0.11",
"vue": "3.2.45",
"vue-router": "4.0.8",
"vuedraggable": "4.1.0",
"vuex": "4.0.2"
Expand Down Expand Up @@ -79,7 +79,7 @@
"@vue/cli-plugin-unit-mocha": "4.5.13",
"@vue/cli-plugin-vuex": "4.5.13",
"@vue/cli-service": "4.5.13",
"@vue/compiler-sfc": "3.0.11",
"@vue/compiler-sfc": "3.2.45",
"@vue/eslint-config-prettier": "7.0.0",
"@vue/eslint-config-typescript": "11.0.2",
"@vue/test-utils": "2.0.0-rc.6",
Expand Down
66 changes: 27 additions & 39 deletions src/components/AcceptRetrieveTelemetryDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,53 +63,41 @@
</q-dialog>
</template>

<script lang="ts">
import { defineComponent, computed, ref, onMounted } from "vue";
<script setup lang="ts">
import { computed, ref, onMounted } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";

export default defineComponent({
name: "AcceptRetrieveTelemetryDialog",
const props =
defineProps<{
modelValue: boolean;
}>();
const emit =
defineEmits<{
(e: "update:modelValue", value: boolean): void;
}>();
Comment on lines +75 to +78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

公式がeなんですね!


props: {
modelValue: {
type: Boolean,
required: true,
},
},
const store = useStore();

setup(props, { emit }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あれ、そういえば以前はemit書かれてないですね。書かなくても大丈夫だったのかな。

const store = useStore();

const modelValueComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});

const handler = (acceptRetrieveTelemetry: boolean) => {
store.dispatch("SET_ACCEPT_RETRIEVE_TELEMETRY", {
acceptRetrieveTelemetry: acceptRetrieveTelemetry
? "Accepted"
: "Refused",
});
const modelValueComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});

modelValueComputed.value = false;
};
const handler = (acceptRetrieveTelemetry: boolean) => {
store.dispatch("SET_ACCEPT_RETRIEVE_TELEMETRY", {
acceptRetrieveTelemetry: acceptRetrieveTelemetry ? "Accepted" : "Refused",
});

const md = useMarkdownIt();
const privacyPolicy = ref("");
onMounted(async () => {
privacyPolicy.value = md.render(
await store.dispatch("GET_PRIVACY_POLICY_TEXT")
);
});
modelValueComputed.value = false;
};

return {
modelValueComputed,
handler,
privacyPolicy,
};
},
const md = useMarkdownIt();
const privacyPolicy = ref("");
onMounted(async () => {
privacyPolicy.value = md.render(
await store.dispatch("GET_PRIVACY_POLICY_TEXT")
);
});
</script>

Expand Down
62 changes: 26 additions & 36 deletions src/components/AcceptTermsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,50 +60,40 @@
</q-dialog>
</template>

<script lang="ts">
import { defineComponent, computed, ref, onMounted } from "vue";
<script setup lang="ts">
import { computed, ref, onMounted } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";

export default defineComponent({
name: "AcceptTermsDialog",
const props =
defineProps<{
modelValue: boolean;
}>();
const emit =
defineEmits<{
(e: "update:modelValue", value: boolean): void;
}>();

props: {
modelValue: {
type: Boolean,
required: true,
},
},
const store = useStore();

setup(props, { emit }) {
const store = useStore();

const modelValueComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});

const handler = (acceptTerms: boolean) => {
store.dispatch("SET_ACCEPT_TERMS", {
acceptTerms: acceptTerms ? "Accepted" : "Rejected",
});
!acceptTerms ? store.dispatch("CHECK_EDITED_AND_NOT_SAVE") : undefined;
const modelValueComputed = computed({
get: () => props.modelValue,
set: (val) => emit("update:modelValue", val),
});

modelValueComputed.value = false;
};
const handler = (acceptTerms: boolean) => {
store.dispatch("SET_ACCEPT_TERMS", {
acceptTerms: acceptTerms ? "Accepted" : "Rejected",
});
!acceptTerms ? store.dispatch("CHECK_EDITED_AND_NOT_SAVE") : undefined;

const md = useMarkdownIt();
const terms = ref("");
onMounted(async () => {
terms.value = md.render(await store.dispatch("GET_POLICY_TEXT"));
});
modelValueComputed.value = false;
};

return {
modelValueComputed,
handler,
terms,
};
},
const md = useMarkdownIt();
const terms = ref("");
onMounted(async () => {
terms.value = md.render(await store.dispatch("GET_POLICY_TEXT"));
});
</script>

Expand Down
30 changes: 10 additions & 20 deletions src/components/HelpPolicy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,20 @@
</q-page>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";

export default defineComponent({
props: {
policy: {
type: String,
required: true,
},
},
setup(props) {
const policyHtml = ref("");
const props =
defineProps<{
policy: string;
}>();
const policyHtml = ref("");

const md = useMarkdownIt();
const md = useMarkdownIt();

onMounted(async () => {
policyHtml.value = md.render(props.policy);
});

return {
policyHtml,
};
},
onMounted(async () => {
policyHtml.value = md.render(props.policy);
});
</script>

Expand Down
22 changes: 8 additions & 14 deletions src/components/HowToUse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@
</q-page>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";
export default defineComponent({
setup() {
const store = useStore();
const howToUse = ref("");
const md = useMarkdownIt();
onMounted(async () => {
howToUse.value = md.render(await store.dispatch("GET_HOW_TO_USE_TEXT"));
});
return {
howToUse,
};
},

const store = useStore();
const howToUse = ref("");
const md = useMarkdownIt();
onMounted(async () => {
howToUse.value = md.render(await store.dispatch("GET_HOW_TO_USE_TEXT"));
});
</script>

Expand Down
26 changes: 10 additions & 16 deletions src/components/OssCommunityInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,18 @@
</q-page>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";
export default defineComponent({
setup() {
const store = useStore();
const ossCommunityInfos = ref("");
const md = useMarkdownIt();
onMounted(async () => {
ossCommunityInfos.value = md.render(
await store.dispatch("GET_OSS_COMMUNITY_INFOS")
);
});
return {
ossCommunityInfos,
};
},

const store = useStore();
const ossCommunityInfos = ref("");
const md = useMarkdownIt();
onMounted(async () => {
ossCommunityInfos.value = md.render(
await store.dispatch("GET_OSS_COMMUNITY_INFOS")
);
});
</script>

Expand Down
22 changes: 7 additions & 15 deletions src/components/QAndA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@
</q-page>
</template>

<script lang="ts">
import { defineComponent, onMounted, ref } from "vue";
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";

export default defineComponent({
setup() {
const store = useStore();
const qAndA = ref("");
const store = useStore();
const qAndA = ref("");

const md = useMarkdownIt();
const md = useMarkdownIt();

onMounted(async () => {
qAndA.value = md.render(await store.dispatch("GET_Q_AND_A_TEXT"));
});

return {
qAndA,
};
},
onMounted(async () => {
qAndA.value = md.render(await store.dispatch("GET_Q_AND_A_TEXT"));
});
</script>

Expand Down