|
@@ -124,16 +124,24 @@ const isPlay = computed(() => {
|
|
|
return status;
|
|
|
});
|
|
|
const isInit = ref(false);
|
|
|
-const tours = computed(() => {
|
|
|
- let tours = store.getters["tour/tours"];
|
|
|
- if (tours.length > 0) {
|
|
|
- if (tourScroll.value && !isInit.value) {
|
|
|
- isInit.value = true;
|
|
|
- new Scrollbar(tourScroll.value, { onlyHorizontal: true });
|
|
|
+const tours = computed(() => store.getters["tour/tours"]);
|
|
|
+
|
|
|
+watch(
|
|
|
+ [tours, tourScroll],
|
|
|
+ (val) => {
|
|
|
+ if (val[0].length > 0 && val[1]) {
|
|
|
+ if (!isInit.value) {
|
|
|
+ isInit.value = true;
|
|
|
+ new Scrollbar(tourScroll.value, { onlyHorizontal: true });
|
|
|
+ console.log("init-Scrollbar");
|
|
|
+ }
|
|
|
}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
}
|
|
|
- return tours;
|
|
|
-});
|
|
|
+);
|
|
|
const onModeChange = (name) => {
|
|
|
store.commit("setMode", name);
|
|
|
};
|