from pathlib import Path
p = Path(r"d:\5ITlearning\DT_TV\YouTeVue2TV\src\views\metalLathe.vue")
s = p.read_text(encoding='utf-8')
s = s.replace("import * as echarts from 'echarts'\n", "import * as echarts from 'echarts'\nimport vueSeamlessScroll from 'vue-seamless-scroll'\n", 1)
s = s.replace("export default {\n name: 'MetalLathe',\n", "export default {\n name: 'MetalLathe',\n components: {\n vueSeamlessScroll\n },\n", 1)
s = s.replace(
"""
""",
"""
""",
1,
)
s = s.replace(
"""
""",
"""
""",
1,
)
s = s.replace(
"""
""",
"""
""",
1,
)
marker = " computed: {\n"
insert = " computed: {\n scrollClassOption() {\n return {\n step: 0.35,\n direction: 1,\n limitMoveNum: 1,\n hoverStop: true,\n openTouch: false\n }\n },\n"
s = s.replace(marker, insert, 1)
start = s.index('.feed-axis-scroll {')
end = s.index('@keyframes feed-axis-scroll-up {', start)
new_css = '''.seamless-scroll-panel {
display: block;
height: 220px;
overflow: hidden;
position: relative;
}
.scroll-list {
display: block;
}
'''
s = s[:start] + new_css + s[end:]
end_keyframes = s.index('.data-item {')
s = s[:s.index('@keyframes feed-axis-scroll-up {')] + s[end_keyframes:]
p.write_text(s, encoding='utf-8')
print('ok')